Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: multi-line in-place edits

by halley (Prior)
on Feb 15, 2005 at 19:23 UTC ( #431302=note: print w/ replies, xml ) Need Help??


in reply to multi-line in-place edits

I am not sure I understand the value of your task (or what you meant by adding \266 bytes). Are you trying to undo a command-line mistake? Are you trying to use some tool that avoids working inside braces, so you're wrapping the file in braces? It all sounds odd. This doesn't work,

perl -p -i -e 'BEGIN { print "{" } END { print "}" }' filename.txt
but this does. Not as quick to type, but...
echo "{" >tmp cat filename.txt >>tmp echo "}" >>tmp mv tmp filename.txt

--
[ e d @ h a l l e y . c c ]


Comment on Re: multi-line in-place edits
Select or Download Code
Re^2: multi-line in-place edits
by Tuppence (Pilgrim) on Feb 15, 2005 at 20:08 UTC

    I provided a simplified example to get the multi-line edit syntax worked out.

    I was attempting to do some code refactoring with in-place editing, when due to failing memory I replaced all the \n's with a upper ascii char. I managed to get that fixed, and just needed the correct syntax for multi line edits.

    -l0666 is so close to the -0777 that I really needed I think perl should have just known I was doing the wrong thing and Done the Right Thing ;) /joke

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (8)
As of 2014-12-26 12:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (171 votes), past polls