[clug] Two (perhaps simple) shell questions.

Andrew Janke a.janke at gmail.com
Tue Aug 18 05:27:09 MDT 2009


> Hm, you could cheat at this point by constructing your own command line:
>
>  /bin/ls *.mnc | xargs -I'{}' -P8 sh -c "echo `basename {}` {}.out"

True...  that should work.

   $ ls * | xargs -I"{}" sh -c "echo \"BOO: {}\"; echo \"FOO: {}\""

Looks somewhat ugly but works...

> Drat!  I never was good at golf.  I suppose I could continue the trend
> with:
>
>  perl -pe 'chop if!($.%2)' < myfile

Well if we are going to start removing syntactic sugar. (I also
cheated a little given that I didn't originally specify even or odd
lines).

   perl -pe 'chop if$.%2' < myfile

Thanks again,


--
Andrew Janke
(a.janke at gmail.com || http://a.janke.googlepages.com/)
Canberra->Australia    +61 (402) 700 883


More information about the linux mailing list