Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!cbosgd!decuac!avolio From: avolio@decuac.UUCP (Frederick M. Avolio) Newsgroups: net.sources.bugs Subject: Re: YASS (yet another shell script) Message-ID: <860@decuac.UUCP> Date: Mon, 17-Mar-86 16:13:51 EST Article-I.D.: decuac.860 Posted: Mon Mar 17 16:13:51 1986 Date-Received: Tue, 18-Mar-86 08:03:42 EST References: <620@ssc-vax.UUCP> <153@sci.UUCP> Distribution: net Organization: ULTRIX Applications Center, MD Lines: 26 In article <153@sci.UUCP>, raymund@sci.UUCP (Raymund Galvin) writes: > In article <620@ssc-vax.UUCP>, aims@ssc-vax.UUCP (John Daley) writes: > > This is a 'simple' little shell script I whipped up, out of need, to > > print a specific line of a specific file. > > Better? I dont know. I dont have access to B shell. > > 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. So, line 10 /etc/termcap does take a while after printing line #10. John's script does use the Bourne Shell, but his basic algorithm (head piped to tail) is usable as an alias, and is quicker than using awk for the above-mentioned reasons. (5 times faster to *return* on /etc/termcap ... rough timing.) -- Fred @ DEC Ultrix Applications Center UUCP: {decvax,seismo,cbosgd}!decuac!avolio INET: avolio@decuac.DEC.COM