Monday, February 04, 2008

Adding a character to a line using Perl

perl -p -i -e 's/(.)$/$1$1/g' filename 

This changed my nonsense file:

ghggk
dethaks
gjfkdld
fyduftsdu
flkgjd kflgjlk flkgjl f

into a slightly different nonsense file:

ghggkk
dethakss
gjfkdldd
fyduftsduu
flkgjd kflgjlk flkgjl ff
posted by Stephen Reese at

0 Comments:

Post a Comment

<< Home