W
William
code in question:
#!/usr/bin/perl -w
use strict;
my $InputFileDir = "/mkapp/webapps/mxrt-cgi/upload_vol/uploaded_files/";
my $savedfilename = "trs_vol.txt.49.22.224.132.LEUNGW5.20060106.13.11.42";
my $requiredList = "trs_vol.txt";
my $dummy_list = "dummylist.txt";
my $originalList = $InputFileDir . $savedfilename;
my $originalListBack = $InputFileDir . $requiredList;
open ( DUMMY_FD, $dummy_list ) || die "Cannot open file $dummy_list\n";
my @lines = <DUMMY_FD>;
close ( DUMMY_FD );
my $start;
my $ticker;
my $bo_fo_eligible;
my $lfo_eligible;
foreach my $currentLine ( @lines ) {
($start, $ticker, $bo_fo_eligible, $lfo_eligible) = ( split(/\|/,
$currentLine) );
system "grep ''$ticker' $originalList' >> $requiredList";
}
Error message:
grep: can't open AA
/mkapp/webapps/mxrt-cgi/upload_vol/uploaded_files/trs_vol.txt.49.22.224.132.LEUNGW5.20060106.13.11.42
grep: can't open SUNW
/mkapp/webapps/mxrt-cgi/upload_vol/uploaded_files/trs_vol.txt.49.22.224.132.LEUNGW5.20060106.13.11.42
contents of dummylist.txt:
|USD AA|1|0|[email protected]
|USD SUNW|0|1|[email protected]
contents of trs_vol.txt.49.22.224.132.LEUNGW5.20060106.13.11.42:
|USD AA|USD
NYSE|Securities|1D|0|ATM|18.222100000000001|18.222100000000001|^M
|USD AA|USD
NYSE|Securities|3D|0|ATM|19.222100000000001|19.222100000000001|^M
|USD AA|USD NYSE|Securities|1W|0|ATM|20.8015|20.8015|^M
|USD AA|USD NYSE|Securities|2W|0|ATM|21.4873|21.4873|^M
|USD AA|USD NYSE|Securities|3W|0|ATM|22.2561|22.2561|^M
|USD AA|USD
NYSE|Securities|1M|0|ATM|25.994400000000002|25.994400000000002|^M
|USD AA|USD NYSE|Securities|3M|0|ATM|25.1098|25.1098|^M
|USD AA|USD
NYSE|Securities|4M|0|ATM|25.313000000000002|25.313000000000002|^M
|USD AA|USD
NYSE|Securities|6M|0|ATM|25.668999999999997|25.668999999999997|^M
|USD AA|USD
NYSE|Securities|9M|0|ATM|26.104699999999998|26.104699999999998|^M
|USD AA|USD
NYSE|Securities|1Y|0|ATM|26.466299999999997|26.466299999999997|^M
|USD AA|USD
NYSE|Securities|1D|0|ATM|18.222100000000001|18.222100000000001|^M
|USD AA|USD
NYSE|Securities|3D|0|ATM|19.222100000000001|19.222100000000001|^M
|USD AA|USD NYSE|Securities|1W|0|ATM|20.8015|20.8015|^M
|USD AA|USD NYSE|Securities|2W|0|ATM|21.4873|21.4873|^M
|USD AA|USD NYSE|Securities|3W|0|ATM|22.2561|22.2561|^M
|USD AA|USD
NYSE|Securities|1M|0|ATM|25.994400000000002|25.994400000000002|^M
|USD AA|USD NYSE|Securities|3M|0|ATM|25.1098|25.1098|^M
|USD AA|USD
NYSE|Securities|4M|0|ATM|25.313000000000002|25.313000000000002|^M
|USD AA|USD
NYSE|Securities|6M|0|ATM|25.668999999999997|25.668999999999997|^M
|USD AA|USD
NYSE|Securities|9M|0|ATM|26.104699999999998|26.104699999999998|^M
|USD AA|USD
NYSE|Securities|1Y|0|ATM|26.466299999999997|26.466299999999997|^M
Question:
I am trying to grep for "USD AA" and "USD SUNW". What is the proper way
to "grep"?
#!/usr/bin/perl -w
use strict;
my $InputFileDir = "/mkapp/webapps/mxrt-cgi/upload_vol/uploaded_files/";
my $savedfilename = "trs_vol.txt.49.22.224.132.LEUNGW5.20060106.13.11.42";
my $requiredList = "trs_vol.txt";
my $dummy_list = "dummylist.txt";
my $originalList = $InputFileDir . $savedfilename;
my $originalListBack = $InputFileDir . $requiredList;
open ( DUMMY_FD, $dummy_list ) || die "Cannot open file $dummy_list\n";
my @lines = <DUMMY_FD>;
close ( DUMMY_FD );
my $start;
my $ticker;
my $bo_fo_eligible;
my $lfo_eligible;
foreach my $currentLine ( @lines ) {
($start, $ticker, $bo_fo_eligible, $lfo_eligible) = ( split(/\|/,
$currentLine) );
system "grep ''$ticker' $originalList' >> $requiredList";
}
Error message:
grep: can't open AA
/mkapp/webapps/mxrt-cgi/upload_vol/uploaded_files/trs_vol.txt.49.22.224.132.LEUNGW5.20060106.13.11.42
grep: can't open SUNW
/mkapp/webapps/mxrt-cgi/upload_vol/uploaded_files/trs_vol.txt.49.22.224.132.LEUNGW5.20060106.13.11.42
contents of dummylist.txt:
|USD AA|1|0|[email protected]
|USD SUNW|0|1|[email protected]
contents of trs_vol.txt.49.22.224.132.LEUNGW5.20060106.13.11.42:
|USD AA|USD
NYSE|Securities|1D|0|ATM|18.222100000000001|18.222100000000001|^M
|USD AA|USD
NYSE|Securities|3D|0|ATM|19.222100000000001|19.222100000000001|^M
|USD AA|USD NYSE|Securities|1W|0|ATM|20.8015|20.8015|^M
|USD AA|USD NYSE|Securities|2W|0|ATM|21.4873|21.4873|^M
|USD AA|USD NYSE|Securities|3W|0|ATM|22.2561|22.2561|^M
|USD AA|USD
NYSE|Securities|1M|0|ATM|25.994400000000002|25.994400000000002|^M
|USD AA|USD NYSE|Securities|3M|0|ATM|25.1098|25.1098|^M
|USD AA|USD
NYSE|Securities|4M|0|ATM|25.313000000000002|25.313000000000002|^M
|USD AA|USD
NYSE|Securities|6M|0|ATM|25.668999999999997|25.668999999999997|^M
|USD AA|USD
NYSE|Securities|9M|0|ATM|26.104699999999998|26.104699999999998|^M
|USD AA|USD
NYSE|Securities|1Y|0|ATM|26.466299999999997|26.466299999999997|^M
|USD AA|USD
NYSE|Securities|1D|0|ATM|18.222100000000001|18.222100000000001|^M
|USD AA|USD
NYSE|Securities|3D|0|ATM|19.222100000000001|19.222100000000001|^M
|USD AA|USD NYSE|Securities|1W|0|ATM|20.8015|20.8015|^M
|USD AA|USD NYSE|Securities|2W|0|ATM|21.4873|21.4873|^M
|USD AA|USD NYSE|Securities|3W|0|ATM|22.2561|22.2561|^M
|USD AA|USD
NYSE|Securities|1M|0|ATM|25.994400000000002|25.994400000000002|^M
|USD AA|USD NYSE|Securities|3M|0|ATM|25.1098|25.1098|^M
|USD AA|USD
NYSE|Securities|4M|0|ATM|25.313000000000002|25.313000000000002|^M
|USD AA|USD
NYSE|Securities|6M|0|ATM|25.668999999999997|25.668999999999997|^M
|USD AA|USD
NYSE|Securities|9M|0|ATM|26.104699999999998|26.104699999999998|^M
|USD AA|USD
NYSE|Securities|1Y|0|ATM|26.466299999999997|26.466299999999997|^M
Question:
I am trying to grep for "USD AA" and "USD SUNW". What is the proper way
to "grep"?