I am having trouble with setting up a regular expression used with egrep. My script reads an input file a line at a time. I would like the egrep command to search for the following pattern: server name at the beginning of the line, then one or more spaces, and then a pound sign.
A line like this would match:
SERVERNAME #
A line like this would not match:
SERVERNAME#
The line in my code that I'm using the egrep command is:
SERVER_CHECK=`echo $LINE | egrep ^${APPL_SERVER}[[:space:]]*\#`
This is not returning the lines that I know match the pattern I'm looking for. Can anyone help me modify my regular expression?
Thanks robotronic, but it is still returning strings with no spaces between the server name and pound sign. Is there a way to say at least 1 or more spaces?
Sorry Galt, I've misread your request. If you want to use an utility which doesn't recognize extended regexp (like the plus "+" sign on Solaris' grep) you can try this: