Arved Sandstrom (
[email protected]) wrote on MMMMDCCCLXXVII
September MCMXCIII in <URL:|| || > lucas (
[email protected]) wrote on MMMMDCCCLXXVI September
MCMXCIII
|| > in <URL:|| > ^^ I have this perl oneliner that I'm using to recognize certain
file
|| > ^^ extentions in a url. This works, but I was wondering if any of
you
|| > know of
|| > ^^ a better way to write this.
|| > ^^
|| > ^^ echo "
http://fu.bar/test.jpg" | perl -ne 'print if((/\.jpg\n$/i)|
|| > ^^ (/\.bmp\n$/i)||(/\.png\n$/i));'
|| >
|| > Yeah.
|| >
|| > echo "
http://fu.bar/test.jpg"
|| >
|| > is a lot simpler.
||
|| I'm gathering - this is just me, mind you - that his actual input is
not
|| manually typing in echo "
http://fu.bar/test.jpg".
||
|| > Or did you want to ask how to grep? In that case, I'd use 'grep', not
|| > perl.
||
|| That works on Windows, does it?
Well, last time I looked, Windows didn't come with perl either.
'grep' works on Windows, yes.
But that's not the point. The user was using 'echo', pipes, and single
quotes to delimit the Perl program. Both 'echo' and pipes are very
Unixy things, and Windows people are always complaining that single
quotes around a Perl one liner doesn't work on their shells.
|| Get over being so elitist.
I don't think assuming the user is using Unix and not Windows is elitist,
given how the user wrote his code.