in reply to Re^2: grep and delete
in thread grep and delete

That doesn't quite match the OPs stated requirements in that it will preserve the entire 'line', (which could be the entire file if this was a binary file), containing the keyword rather than truncating immediately after the keyword.

Has the advantage that it does matter how big the file (assuming non-binary), or how far into the file the truncation point is.

Has the disadvantage that it will consume more disc space rather than reducing it--if that was the original intent.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Replies are listed 'Best First'.
Re^4: grep and delete
by davido (Cardinal) on Jan 21, 2006 at 16:31 UTC

    I think it does match the OP's spec: He said he wanted to truncate the lines below the word, ie the next line and beyond. Maybe I'm misreading it, but that's how it sounded to me. And the fact that he is speaking of lines leads me to believe that he is dealing with a file that has line endings.


    Dave