Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Find Lines that DO not begin with certain Strings

Status
Not open for further replies.

kkitt

Programmer
Dec 1, 2002
122
US
I have been able to create and Regular Expression that finds all the lines that begin with the following phrases (HDR,SHP,BIL,INS,CNT).
Code:
^((HDR)|(SHP)|(BIL)|(INS)|(CNT))

What I need to be able to find is all lines that DO NOT match these. I have tried multiple things and it either still finds one of these or nothing at all.

Thanks in advance
 
I'm not sure what you're using to interpret your regex but, using AIX 5.1 egrep

data
Code:
one this is a line
two this is a line
three this is a line
four this is a line
five this is a line
then
Code:
egrep "^one|two" data.file
returned the firs two lines and
Code:
egrep -v "^one|two" data.file
returned the last three
Does this help

Columb Healy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top