Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
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
Replies are listed 'Best First'.
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 browsing the Monastery: (11)
As of 2015-07-31 05:12 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 (274 votes), past polls