Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^2: sed (was: Save all but line 32!)

by Aristotle (Chancellor)
on Sep 19, 2002 at 18:57 UTC ( [id://199258]=note: print w/replies, xml ) Need Help??


in reply to (OT) Re: Save all but line 32!
in thread Save all but line 32!

Golf time! :^) sed -e 32d filename

Makeshifts last the longest.

Replies are listed 'Best First'.
Re: Re^2: sed (was: Save all but line 32!)
by BrowserUk (Patriarch) on Sep 19, 2002 at 23:11 UTC

    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.

        Also, yours is 12 keystrokes.

        No. <^somechar> is meant to indicate that I need to type control+G. Ie. a single control key.

        Fair play to you on the multiple files though:)


        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
        And in all of the sed implementations I've seen so far, you can leave out the '-e' since the first argument (when there's no -e) is by default assumed to be the sed script.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://199258]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (4)
As of 2024-04-19 04:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found