Hi TimI 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
i have lert a few basics but still im stuck on a problem ;-( maybe you could help.
Using the code yyou sent me it will add the exact text stated at the bottom of the file it opens.
What i need to do now is instaed of having the text in the code, have it open up another txt file read the whole txt file and then add all the text from that said file to the end of the outfile, im sure this is simple but ive obviously missed something somewere ;-(
any help would be great
Thanks
sadman
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>