Awk / Grep Help Needed

Fuzznuts

Senior member
Nov 7, 2002
449
0
0
I have around 2000 files that i need to pull data from. they are basically a list of cars with data at specific points on each line for a vehicle.

eg. i need to return chars 3 to 17 and 34 and 46 from a line where the first 3 charecters equal a certain value.

I have looked around on the net but am drwaing blanks with how to do this find the values is easy but its getting the only the vaules i need out of the line thats proving to be a stuggle.

Any help greatly appreciated.

Cheers

Fuzz
 

Fuzznuts

Senior member
Nov 7, 2002
449
0
0
nearly :)

i got that far with awk '/^SEARCH/ {print substr($0,4,20)}'

the problem lies in that i need to pull mutiple sets of charecters form the same line. i am stuck in getting the following sets of data out. :( i have only sussed how to pull out the first set :(

Cheers though

Fuzz
 

Fuzznuts

Senior member
Nov 7, 2002
449
0
0
DOH cut can use mutiple sets :) which is kinda cool

so you tip of grep ^abc foo.txt |cut -b 3-17

becomes

grep ^abc foo.txt |cut -b 3-17,45-70,70-123

Cheers for pointing me in the right direction :)

Fuzz