[clug] Two (perhaps simple) shell questions.
Jack Kelly
endgame.dos at gmail.com
Tue Aug 18 05:31:28 MDT 2009
On Tue, Aug 18, 2009 at 9:27 PM, Andrew Janke<a.janke at gmail.com> wrote:
> 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
I can't do perl, but I want to play. Here's a pointfree Haskell version:
main = fmap (unlines . (map snd) . (filter ((== 0) . (`mod` 2) . fst))
. (zip [1..]) . lines) getContents
Not so great on the character count, but it was fun to build.
-- Jack
More information about the linux
mailing list