cat-n

runghc -eを直したので以下でいける。 $ runghc -e 'import System;main=getArgs>>=mapM_ catFile;catFile a=do{c<-readFile a;mapM_ putStrLn $ zipWith (\x y->(reverse$take 4$reverse(" "++(show x)))++" "++y) [1..] (lines c)}' a.txt 1 aaa 2 bbb 3 …