MLUG: [MLUG] egep regexp in different unix OSes
[MLUG] egep regexp in different unix OSes
Email address obfuscation in effect -- please click here to turn it off.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
I wrote a tcsh script that had a line that looked like this:

egrep "^[ ]*${famID}[ ]+[#-~]+[ ]+[#-~]+[ ]+${momID}[ ]" $pedfile

In the line I really used, the "[ ]" was a [<space><tab>]' to represent
white space.  That worked great on Solaris, but then I sent it to a friend
of mine and it failed for him in Linux.  To make it work, he changed the
regexp to the following:

"^\[\ \]\*${famID}\[\ \]+\[\!-z~\]+\[\ \]+\[\!-z~\]+\[\ \]+${momID}\[\ \]"

He took out the tab characters, so he could have done this instead:

"^ *${famID} +\[\!-z~\]+ +\[\!-z~\]+ +${momID} "

Does anyone know why the regexp I had written, and which worked under
Solaris, failed under GNU/Linux?  I was a little surprised.  I don't
unerstand why my friend had to escape the square brackets.  That would
seem to imply that they should be interpretted literally.

All tips greatly appreciated!

Best,

Mike
_______________________________________________
members mailing list
EMAIL:PROTECTED
http://mlug.missouri.edu/mailman/listinfo/members