I would recommend getting a strong grasp of Perl before you start trying to
make one-liners for problems like this, since you can end up making a simple
problem much more complicated.  What's wrong with this:

####################

use strict;
use warnings;
open(OUTFILE,">>script1") || die "Couldn't open script1 for writing!\n";
print OUTFILE "ddd\n";
close OUTFILE;

####################

-----Original Message-----
From: sadman [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, October 28, 2003 2:56 PM
To: [EMAIL PROTECTED]
Subject: Newbe needs help


Hi all can anyone help with a direct command line syntax for the following
im trying to add text to the end of the last line in a text file like so

aaa
bbb
ccc


Wishing to add ddd on the end of this list.
 I have tried the following but it doesnt have quite the desired effect 
any help would be good.

perl -pi -e s/'$'/'ddd'/g script1

This gives me this


aaaddd
dddbbbddd
dddcccddd
dddddd
ddd



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to