[lug] Another sed question.
David Anselmi
anselmi at anselmi.us
Thu Mar 31 17:44:25 MST 2005
Jeff Schroeder wrote:
> Shannon asked:
>
>>I would like to locate a string of characters in a file, and delete
>>the entire line that contains that string.
Do you have any books on the shell or Unix? That's a pretty basic
question. There are alos many tutorials on the web, and even this book:
http://www.icon.co.za/~psheer/book/index.html.gz
That has chapters on regexs, sed, and a bunch of other stuff you might
find useful. You'd be much better off reading a book about the shell or
sed (or even vi, which can do this as well) than asking your questions
one by one here. In reading you'll pick up the answers to your next 3
questions while looking up the first.
> Rather than using sed, I'd use grep:
Rather than grep, if you want the results in the same file, I'd use perl:
perl -line '/match/ or print' file
vi might be a good choice to get the results in the same file, since you
might be more familiar with it than perl (and might not have perl or its
docs handy).
Dave
More information about the LUG
mailing list