There is a2p, which converts awk scripts to Perl code. In your case, it creates the following program:
#!/opt/perl-5.18/bin/perl eval 'exec /opt/perl-5.18/bin/perl -S $0 ${1+"$@"}' if $running_under_some_shell; # this emulates #! processing on NIH machines. # (remove #! line above if indigestible) eval '$'.$1.'$2;' while $ARGV[0] =~ /^([A-Za-z_0-9]+=)(.*)/ && shift; # process any FOO=bar switches $, = ' '; # set output field separator $\ = "\n"; # set output record separator while (<>) { ($Fld1,$Fld2,$Fld3,$Fld4) = split(' ', $_, -1); print $Fld4; }
Most of that is just setting up explicitly what perl has as defaults anyway. The interesting part (for you) is the while loop. Either use that in a oneliner or keep the whole thing as a Perl program.
In reply to Re: simple awk feature in perl
by Corion
in thread simple awk feature in perl
by jasonwolf
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |