in reply to How do I delete from a delimiter to the end of a file?

I actually like ikegami's solution better, but this is what I thought of first:

perl -pi -e 'BEGIN{$/="\cB"} s{-{6}\sYahoo.*\z}{$/}ms' list of files

Replies are listed 'Best First'.
Re^2: How do I delete from a delimiter to the end of a file? (slurp--)
by tye (Sage) on Aug 25, 2008 at 03:12 UTC

    I suspect yours will work better than ikegami's in a large number of situations. Reading 20k messages one-at-a-time is likely a better idea than requiring the entire archive of 20k messages to be read into memory at once.

    Yours is even a complete example, not just a single regex that leaves the process of replacing files and slurping as an exercise.

    - tye