The file I have is only the old symbols and it is a list of 590; like below (minus the spaces)
A.TL5E001100.TAV
A.TL5F001560.TAV
A.TL5T001240.TAV
A.TL5E001230.TAV
A.TL5E001270.TAV
So A.TL5E001100.TAV needs to change to +TL\E5C1100.TAV, A.TL5F001560.TAV needs to change to +TL\F5C1560.TAV, etc
I rewrote the code to be a lot simpler and only did one substitution just so I could see what the output is. Now it runs, but I get no output so I need to read up on matching and substitution string syntax.
use strict; use warnings; my $input = 'TAV.stock.opt.oldsym.txt'; { unless(open(INPUT,$input)) { die "\nCannot open $input\n"; } <INPUT>; my @lines; while(my $line = <INPUT>) { chomp $line; if ($line =~ m/^A.TL5E00/) { $line =~ s/A.TL5E00/'+TL\E5C'/g; } } close INPUT; foreach my $line(@lines) { print $line,"\n"; } }
In reply to Re^4: Substitute script for a newbie
by jspanos
in thread Substitute script for a newbie
by jspanos
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |