mirror of
https://github.com/simonmichael/hledger.git
synced 2024-11-08 07:09:28 +03:00
15 lines
669 B
Haskell
15 lines
669 B
Haskell
#!/usr/bin/env runhaskell
|
|
-- filters uninteresting fields from profile data lines
|
|
-- Simon Michael 2007
|
|
import Data.List
|
|
main = interact $ unlines . map print . filter (/=[]) .
|
|
(["cost-centre - - entries %time %mem %t-inh %m-inh"]++) . tail .
|
|
dropWhile (notElem "entries" . words) . lines
|
|
where
|
|
print line = tabcat [paddedfirst, field 3, field 4, field 5, field 6, field 7]
|
|
where
|
|
tabcat = concat . intersperse "\t"
|
|
first = takeWhile (==' ') line ++ (takeWhile (/=' ') $ dropWhile (==' ') line)
|
|
paddedfirst = first ++ (take (60 - (length first)) $ repeat ' ')
|
|
field n = words line !! n
|