On Friday 13 May 2005 11:00 am, Ben Higginbottom wrote:
Hi Folks,
A rather general question on scripting. I'm taking a file and using awk, removing the first column from it which consists of lines like this:
208A03860010237500300767698/00125.04.20050521770084998030132879550012
I then want to remove the 2nd and 3rd characters and dump them to a separate file (each extraction on a separate line) at which point uniq -c will be run on the file and the results emailed out.
The question is does anyone have any idea on removing the 2nd and 3rd characters, I suspect I can use some kind of regular expression and piping the file through sed to expand everything out and then use awk again to remove the desired parts. However what I know of regex can be written in very large type on the back of a postage stamp.
Any suggestions or different approaches gratefully received. AWK has a substring function. x=substr($1, 2,2); In this case, x will contain the string "08". $1 is the first word in the line, which would be the string you have above.
--
Jerry Feldman