in reply to Re^5: Substitute script for a newbie
in thread Substitute script for a newbie
There isn't a hard rule, just individual cases like
A.TL5E00* becomes +TL\E5C*, A.TL5F00* becomes +TL\F5C*, and A.TL5G00* becomes +TL\G5C*.
I've actually made great progress on my own. I think my only obstacle is still how to format the substitution string so it will read things like '\F' as a string and not a function
Here is my latest version. The output is ugly since it has the $VAR tags (this is something I should be able to fix), but I am feeling a lot better about where I am at
use strict; use warnings; use Data::Dumper; my $input = 'TAV.stock.opt.oldsym.txt'; my @NewSym; { 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; push @NewSym,$line; } } close INPUT; print Dumper(@NewSym); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^7: Substitute script for a newbie
by Laurent_R (Canon) on Jul 14, 2015 at 20:07 UTC |