Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Re: multi-line in-place edits

by holli (Monsignor)
on Feb 15, 2005 at 19:36 UTC ( #431304=note: print w/ replies, xml ) Need Help??

in reply to multi-line in-place edits

perl -0ni -e "print qq({$_})" file

holli, /regexed monk/

Comment on Re: multi-line in-place edits
Download Code
Replies are listed 'Best First'.
Re^2: multi-line in-place edits
by jsprat (Curate) on Feb 16, 2005 at 01:18 UTC
    perl -0ni -e "print qq({$_})" file

    Caveat - this will fail quietly if the file contains any null bytes. -0 with no arguments sets the record separator to \0.

    Better to explicitly use -0777. This will cause perl to slurp the whole file, since "there is no legal byte with that value" (quoted from perlrun)

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (8)
As of 2015-11-30 10:44 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (769 votes), past polls