Reimplement grep
in Perl, and then use system
to call your new grep
command:
# create a new perl script called "grep" in current directory
# put this near the beginning of your script
open GREP, ">grep";
print GREP <<'EOF';
#! perl
$regex = $ARGV[0];
while (<STDIN>) {
print if $_ =~ $regex;
}
EOF
$yesterday = ...;
system("perl grep \"^2013/$yesterday-\" Log_2013_$yesterday*.txt > Log_2013_$yesterday.txt");
# note that you have to say system("perl grep ...") now
# and not just system('grep ...")
1
solved make this perl script work on window [closed]