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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Conditional Line Deletion

Status
Not open for further replies.

RTB2805

Programmer
Jul 26, 2010
2
GB
I have a file with two columns, I need to delete any lines where $2 id black should such lines exist.

Any assistance appreciated.
 
where $2 id black
What do you mean ?
Something like this ?
Code:
awk '$2!="black"' /path/to/input >output

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Sorry, I'm having an attack of dystypia!

That should read is blank; ie $2=""

Rob
 
So, even simpler:
Code:
awk '$2' /path/to/input >output

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top