Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Prepending characters to lines in file

by wardk (Deacon)
on Aug 03, 2001 at 03:15 UTC ( #101837=note: print w/ replies, xml ) Need Help??


in reply to Prepending characters to lines in file

perl -i.bak -pe 's/$_/> $_/' filename
could be one way


Comment on Re: Prepending characters to lines in file
Download Code
Re: Re: Prepending characters to lines in file
by chipmunk (Parson) on Aug 03, 2001 at 07:10 UTC
    That will work as long as your lines don't contain regex metacharacters. :)

    You don't really need to match the line itself; just matching the beginning of the line works fine: perl -pi.bak -e 's/^/> /' filename

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (10)
As of 2014-11-22 16:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (123 votes), past polls