in reply to Save all but line 32!

Offtopic for the site, but sed's a much better tool for that job. It's very easy to do with sed addressing:
sed -n 32\!p filename
Sadly, I don't have a clever or shorter way to do it in perl. The number 32 can be anything, of course


Replies are listed 'Best First'.
Re^2: sed (was: Save all but line 32!)
by Aristotle (Chancellor) on Sep 19, 2002 at 18:57 UTC
    Golf time! :^) sed -e 32d filename

    Makeshifts last the longest.

      8 instead of 11 chars (excluding the filename) :^)

      t filename^G32^M^D^S

      T is my editor

      ^G32 := goto line 32

      ^M := return to terminate/execute the goto

      ^D := delete the line

      ^S := Save and exit!

      Cor! Like yer ring! ... HALO dammit! ... 'Ave it yer way! Hal-lo, Mister la-de-da. ... Like yer ring!
        It's 10 actually, I can leave out a space. sed -e32d filename Also, yours is 12 keystrokes. And once we get to multiple files, yours grows linearly, mine is constant.. :^) for F in *;do sed -e32d "$F";done (NB: a loop is necessary since we'll otherwise only delete the 32nd line of the first file.)

        Makeshifts last the longest.