[lug] Another sed question.

Jeff Schroeder jeff at neobox.net
Thu Mar 31 13:11:34 MST 2005


Shannon asked:

> I would like to locate a string of characters in a file, and delete
> the entire line that contains that string.
>
> How would I go about doing that?

Rather than using sed, I'd use grep:

grep -v "this is the string of characters" file.txt

The -v argument skips any lines that match your regexp.  You'd probably 
want to redirect that output into another file, of course.

HTH,
Jeff



More information about the LUG mailing list