On Mon, Apr 15, 2002 at 11:53:55AM -0500, Yaron (jethro at freakzilla.com) wrote:
>   Hey,
> 
> On Mon, 15 Apr 2002, Amy Tanner wrote:
> 
> > What's the simplest way to do the following in perl:
> >
> > Take as input a file.  Search for a line containing a particular string.
> > Then append to that line.
> 
> 
> #!/usr/bin/perl
> #
> # AppLine.pl - Append stuff to line.
> #
> $LOOKFOR="Line Has This In It";
> $APPEND="Append this";
> 
> while($line=<STDIN>) {
> 	if ($line =~ /$LOOKFOR/) {
> 		chomp ($LINE);  # remove linefeed
> 		$line="$line$APPEND\n";
> 	}
> 
> 	print $LINE;
> }

Thank you - this is what I needed.

-- 
Amy Tanner
amy at real-time.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 524 bytes
Desc: not available
Url : http://shadowknight.real-time.com/pipermail/tclug-list/attachments/20020415/7e07cd1d/attachment.pgp