editorreilly
December 23rd, 2008, 07:54 PM
I've got a file ale.txt' that looks like this:
M20922C01 BF INTV 1 14:38:42:13 14:44:15:29 M20922C01
M20922C01 BF INTV 4 14:44:50:24 15:12:02:04 M20922C01
M20922C01 BF INTV 5 14:44:50:24 15:12:02:04 M20922C01
M20922C01 BF INTV 6 14:44:50:24 15:12:02:04 M20922C01
I want to use grep to assign some of the values in the file a variable.
I am using
INPUT=$(cat -v ale.txt | head -1) to assign the variable INPUT to line 1.
echo $INPUT
M20922C01 BF INTV 1 14:38:42:13 14:44:15:29 M20922C01
This is as far as I can get. What I need to do now is assign 'M20922C01 BF INTV 1' to another variable and the numbers '14:38:42:13' to yet another variable.
How do I go about using grep to get those variables assigned? Is grep the best way to go about it?
Thanks in advance for any help.
-Ryan.
M20922C01 BF INTV 1 14:38:42:13 14:44:15:29 M20922C01
M20922C01 BF INTV 4 14:44:50:24 15:12:02:04 M20922C01
M20922C01 BF INTV 5 14:44:50:24 15:12:02:04 M20922C01
M20922C01 BF INTV 6 14:44:50:24 15:12:02:04 M20922C01
I want to use grep to assign some of the values in the file a variable.
I am using
INPUT=$(cat -v ale.txt | head -1) to assign the variable INPUT to line 1.
echo $INPUT
M20922C01 BF INTV 1 14:38:42:13 14:44:15:29 M20922C01
This is as far as I can get. What I need to do now is assign 'M20922C01 BF INTV 1' to another variable and the numbers '14:38:42:13' to yet another variable.
How do I go about using grep to get those variables assigned? Is grep the best way to go about it?
Thanks in advance for any help.
-Ryan.