Results 1 to 2 of 2
Here's my situation. I have to write a script that searches text files for Soc. Sec. No.s and that script has to be able to run on Linux and on ...
- 05-07-2008 #1Linux User
- Join Date
- Jun 2007
- Posts
- 318
What's wrong with this ERE in awk?
Here's my situation. I have to write a script that searches text files for Soc. Sec. No.s and that script has to be able to run on Linux and on UNIX systems called Tru64. The shell that's available on both is ksh so I'm writing in that.
When I find a file with 9-digit no.s in it I want to vaidate them so I want to extract them from the file. I'm trying to use awk (function match) to find its position in a line. Below is a sample which works on Tru64 but not on (Red Hat) Linux. Why?
echo ' 111111111 ' | awk -F'jhdjh' '{print match($1,"[0-9]{9}")}'
Tru64 returns position 2 and Linux returns 0.
Thanks for your help.
- 05-08-2008 #2Linux User
- Join Date
- Jun 2007
- Posts
- 318
Firgured it out. It's the old RTFM. I need the --re-interval option on Linux in order for it to work. I don't know how many times I looked at that manpage before I saw it. Oh well.


Reply With Quote