Mar 16, 2004 #1 mdraja Programmer Oct 14, 2003 44 GB Hi, I need to be able to read through a file and highlight all lines that have a numeric character in the 19th position. Any help greatly appreciated
Hi, I need to be able to read through a file and highlight all lines that have a numeric character in the 19th position. Any help greatly appreciated
Mar 16, 2004 1 #2 PHV MIS Nov 8, 2002 53,708 FR The awk way: awk 'substr($0,19,1)~[0-9]' /path/to/file The grep way: grep -E '^.{19}[0-9]' /path/to/file Hope This Help, PH. Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 Upvote 0 Downvote
The awk way: awk 'substr($0,19,1)~[0-9]' /path/to/file The grep way: grep -E '^.{19}[0-9]' /path/to/file Hope This Help, PH. Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
Mar 16, 2004 Thread starter #3 mdraja Programmer Oct 14, 2003 44 GB thanks PHV You have been a legend mate Upvote 0 Downvote
Mar 16, 2004 #4 Ygor Programmer Feb 21, 2003 623 GB I think you would get errors unless.... [tt] grep -E '^.{[red]18[/red]}[0-9]' /path/to/file [/tt] Upvote 0 Downvote
Mar 16, 2004 #5 Ygor Programmer Feb 21, 2003 623 GB Also.... [tt] awk 'substr($0,19,1)~[red]"[/red][0-9][red]"[/red]' /path/to/file [/tt] Upvote 0 Downvote
Mar 16, 2004 #6 PHV MIS Nov 8, 2002 53,708 FR Good catch, Ygor. I'm feeling like a monday morning today. Will try to do more test before posting. Upvote 0 Downvote
Mar 16, 2004 Thread starter #7 mdraja Programmer Oct 14, 2003 44 GB thanks all I noticed the 18 when I was applying the grep and I was initially always 1 charachter out ... but the principle got me there in the end Thanks for all the help Upvote 0 Downvote
thanks all I noticed the 18 when I was applying the grep and I was initially always 1 charachter out ... but the principle got me there in the end Thanks for all the help