I would like to find a word or character in a file and
replace it with another word or character, while
leaving others untouched.  Currently, I am using the
following method

#!/bin/perl -Dr -w
open(FILE,"$ARGV[0]") || die "Can't open $ARGV[0]:
$!\n";
open(FILE2,">$ARGV[0].spi") || die "Can't open
$ARGV[0]_new: $!\n";
while (<FILE>)
{
  if (/(^VV\d+ )(TA)x(\d)x(.*)/)
  {
    print FILE2 $1,,$2,"[",$3,"]",$4,"\n";
  }
 else
  {
    print FILE2 $_;
  }
}
close FILE;
close FILE2;

Thanks



__________________________________________________
Do You Yahoo!?
Yahoo! Messenger - Instant Messaging, Instant Gratification. (Now with new emoticons!)
http://messenger.yahoo.com.sg/

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

Reply via email to