Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
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

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?
[1nickt]: sad but true erix

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (3)
As of 2017-11-18 22:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:













    Results (278 votes). Check out past polls.

    Notices?