[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [Fun With Perl] index.html



John Carter wrote:
> perl -nle 'print "wget http://www.whatever.com/~someone/$1"
>   if /href="([^"\.]+\.mp3)"/' < index.html | bash -ex
 
Just a little nitpicking:

  wget `perl -nle 'print " http://www.whatever.com/~someone/$1"\
        if /href="([^"\.]+\.mp3)"/' < index.html`

avoids multiple invocations of wget.

Otherwise, yeah, `-n' (or `-p') really makes some tasks
trivial. BTW, remember, you can use it in scripts too
and probably avoid a lot of 'while(<ARGV>)' etc.
Just put non-loop code in BEGIN {} and END {}.

Roland
--
perl -e '@_=@ARGV;$_="@_[-3,-2,-1]";s{([@{[$_[-1]]}])}#($0=$1.
${[qw[>$%, ()%{&", &"=, |}+&" *]]}[$@++])=~y/*=->$%&"(-){-}+,/
lusternohack /,$0#eg; print; '        -- Roland Giersig, JAPH.

==== Want to unsubscribe from this list? (Don't you love us anymore?)
==== Well, if you insist... Send mail with body "unsubscribe" to
==== fwp-request@technofile.org