
davorg
Thaumaturge
Mar 3, 2005, 4:31 AM
Post #2 of 2
(807 views)
|
|
Re: [kektex] How to append to the end of a phrase
[In reply to]
|
Can't Post
|
|
Hi, I have a list of words that I need to append a suffix to in a text file, each word separated by a newline. For example I have a list like this one: aaa bbb ccc and I want a perl script that can read each line and append the suffix xxx for example, so I get a new txt file with: aaaxxx bbbxxx cccxxx A friend referred me to this site since I don`t know any perl. Can anyone give me a hand? No need for a program, just do it from the command line.
$ perl -i~ -pe 'chomp; $_ .= "xxx\n"' your_filename_here -- Dave Cross, Perl Hacker, Trainer and Writer http://www.dave.org.uk/ Get more help at Perl Monks
|