Removing a line from a file.
Posted on 2007-11-23
I know this question is everywhere on here - but im missing some detail, either due to brain fart or... I figured this out a few weeks ago and either deleted it or forgot to document it now i can't seem to figure it out again. Argg - thanks for your help!
Heres the one liner:
perl -i -ne 'print unless /EXP/' file
This prints contents minus the line in the match.
1. Needs to be in perl script not a one liner.
2. Needs to remove the line from a file permanently
3. There are 3 columns in the file, we only know the content of one portion of the line.
Example data from dbfile.txt:
The only information we have is domain_5.com so we need to remove that entire line containing that domain.