<> :doc "grep.n3 - Search Files for Pattern"; 
   dc:author [ foaf:name "Sean B. Palmer"; 
               foaf:homepage <http://inamidst.com/sbp/> ]; 
   :usage ("grep.n3" :options "pattern" "filenames+" 
           "-h/--help 'Display a help message'"
           "-t/--test 'Perform builtin code tests'") .

_:grep :def ((_:filenames _:pattern) 
   (:Comment "Grep through filenames for pattern)
   (:Example (_:grep ("tag:pluvo.org,2006:words") "ria")
             (:prints "20. Thesmophoriazousae"))
   (:for _:line (:lines _:filenames)
         ((:Regexp _:pattern) _:line (:out _:line)))

_:main :main ((_:argv)
   (or (:Arg "--help") (:not :args) (:help))
   ((:Arg "--test") (:check _:grep) (_:quit))
   (_:grep (:args!"filenames") (:args!"pattern")))

# EOF

