merlyn@iwarp.intel.com (Randal Schwartz) (12/21/89)
In article <428@sunny.ucdavis.edu>, poage@sunny (Tom Poage) writes: | Alternatively, try | | sed -n '/pattern/{ | p | q | }' filename | | The matching line is printed immediately since output is | flushed on close. Tom. In Perl, to print only the first line of each file that matches a pattern, try: perl -ne 'print, close(ARGV) if /pattern/;' file1 file2 file3... This differs from the sed thing above in that sed would *completely* quit, where this just goes to the next file. Just another Perl hacker, -- /== Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 ====\ | on contract to Intel's iWarp project, Hillsboro, Oregon, USA, Sol III | | merlyn@iwarp.intel.com ...!uunet!iwarp.intel.com!merlyn | \== Cute Quote: "Welcome to Oregon... Home of the California Raisins!" ==/