Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site umcp-cs.UUCP Path: utzoo!watmath!clyde!burl!ulysses!gamma!epsilon!zeta!sabre!petrus!bellcore!decvax!decwrl!amdcad!lll-crg!gymble!umcp-cs!chris From: chris@umcp-cs.UUCP (Chris Torek) Newsgroups: net.sources.bugs Subject: Re: YASS (yet another shell script) Message-ID: <359@umcp-cs.UUCP> Date: Mon, 17-Mar-86 18:42:45 EST Article-I.D.: umcp-cs.359 Posted: Mon Mar 17 18:42:45 1986 Date-Received: Wed, 19-Mar-86 04:04:53 EST References: <620@ssc-vax.UUCP> <153@sci.UUCP> <860@decuac.UUCP> Distribution: net Organization: U of Maryland, Computer Science Dept., College Park, MD Lines: 19 In article <860@decuac.UUCP> avolio@decuac.UUCP (Frederick M. Avolio) writes: >In article <153@sci.UUCP>, raymund@sci.UUCP (Raymund Galvin) writes: >> The following alias will print any single line from a text file: >> alias line 'awk NR==\!:1 \!:2-$' >> The following alias will print a range of lines from a text file: >> alias list 'awk NR==\!:1,NR==\!:2\{print\ NR\":\"\$0\} \!:3-$' >The problem with the awk versions is that they process the whole file, >even after you are no longer interested in output. Not if you do it right: alias line "awk 'NR == \!:1 { print; exit }' \!:2*" alias list "awk 'NR == \!:1, NR == \!:2 { print NR "'":" $0 } NR == \!:2+1 { exit }'"' \!:3*" -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 1415) UUCP: seismo!umcp-cs!chris CSNet: chris@umcp-cs ARPA: chris@mimsy.umd.edu