in reply to Perl as grep
I tried perl -p "*.*" -e "print $_ if /regex/" and it's complaining about the *.*.
Aye, that's because you've got it in the wrong place. It looks like you want:
perl -ne "print if /regex/" *.*or maybe
perl -pe "next unless /regex/" *.*Though I'm not sure about the globbing under windows. I seem to recall that each program must do its own. Perhaps what you really need is this:
perl -ne "BEGIN { @ARGV = glob(qq(@ARGV)); } print if /regex/" "*.*"
caveat lector! this code is untested.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Perl as grep (-p/next)
by tye (Sage) on Dec 02, 2003 at 18:36 UTC |