in reply to Remove string from file
Isn't this deleting the pattern from the line, rather than deleting the line itself?
If it's Unix/Linux, you might consider using grep or fgrep with the "-v" switch to skip lines containing a certain pattern.
For example, to remove lines containing "TOM" anywhere in the line, use fgrep ("fixed grep") like this:
Or to remove lines containing the word "TOM":% fgrep -v TOM userlist.txt > edited.txt
% grep -v "\<TOM\>" userlist.txt > edited.txt
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Remove string from file
by bran4ever (Novice) on May 21, 2006 at 14:03 UTC | |
by liverpole (Monsignor) on May 21, 2006 at 14:15 UTC |