in reply to grep and delete
If the files aren't huge, or the word appears fairly early (a few hundred MB) in the file, then you can do this with a "one-liner" (wrapped for viewing; adjust quoting to your OS needs):
perl -e"BEGIN{$/=qq[the word or phrase]}" -ne"$n=tell ARGV; close ARGV; truncate $ARGV, $n" path\to\the\file
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: grep and delete
by davido (Cardinal) on Jan 21, 2006 at 06:25 UTC | |
by BrowserUk (Patriarch) on Jan 21, 2006 at 07:48 UTC | |
by davido (Cardinal) on Jan 21, 2006 at 16:31 UTC |