All,
I have been working on this script to extract information based on group
selection, being E0, GE, E5. This works fine however I am testing the
selection to see if E$ is entered and it so escape the $ in the process.
Am I missing something because it never finds E$ in any of the files I'm
parsing and I know its in there. On a side note my opt's never error
out to tell the use the correct usage, I could swear that the code is
correct.
Thanks for the help!
Tim
use strict;
use Getopt::Std;
use vars qw($opt_s $opt_d $opt_g $opt_t);
my $source;
my $dest;
my $grp;
my $typ;
if (! getopts('s:d:g:t:')) {
die "Usage: cmeparser -s -d -g -t\n";
}
if ($opt_s) {
$source = $opt_s;
}
if ($opt_d) {
$dest = $opt_d;
}
if ($opt_g) {
$grp = $opt_g;
}
if ($opt_t) {
$typ = $opt_t;
}
open (CME, "$source") or die "Can't open file: $!\n";
open (CAT, ">>$dest") or die "Can't open file: $!\n";
while (<CME>) {
if ( $grp =~ /E\$/) {
$grp = "E\$";
} else {
next;
}
if ( substr($_, 69,2) =~ /($grp)/) {
if ( substr($_, 91, 2) =~ /($typ)/) {
print CATUS;
}
}
}