Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
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 making s'mores by the fire in the courtyard of the Monastery: (14)
As of 2014-09-19 19:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (144 votes), past polls