Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^2: multi-line in-place edits

by jsprat (Curate)
on Feb 16, 2005 at 01:18 UTC ( #431405=note: print w/ replies, xml ) Need Help??


in reply to Re: multi-line in-place edits
in thread multi-line in-place edits

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)


Comment on Re^2: multi-line in-place edits
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (13)
As of 2015-07-28 10:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (254 votes), past polls