bph@buengc.BU.EDU (Blair P. Houghton) (05/14/89)
In article <132@mcl.UUCP> stacy@mcl.UUCP (Stacy L. Millions) writes: >In article <1539@cmx.npac.syr.edu>, gefuchs@herbrand.uucp (Gill E. Fuchs) writes: >> yup, it took me a while to figure out what RTFM means (in more then one way) >> first i tried to issue the command RTFM and unix came back telling me: >> RTFM: Command not found. > >Now there is a great idea. After reading the above article, >I immediately created a rtfm shell script in the local bin. Being told RTFM doesn't always help, like when the sh(1) says while _list_ do _list_ done and you code while newfoo do ls $foo; foo=`newfoo` done and it's days before you figure out that you gotta while newfoo do ls $foo; foo=`newfoo` done to get sh to consume it... In that vein, I've R'ed TMFM, and I've twiddled the permutations, but I just can't seem to get sed(1) to print lines 110 through 115 of a file. It seems the most basic of things, but sed(1) insists on printing the whole file, no matter what I do... What is the proper one-liner syntax for that? --Blair "I hate the stupid questions, I really do. Email, please, and keep my name out of the papers..."
ark@alice.UUCP (Andrew Koenig) (05/14/89)
In article <2859@buengc.BU.EDU>, bph@buengc.BU.EDU (Blair P. Houghton) writes: > In that vein, I've R'ed TMFM, and I've twiddled the permutations, but > I just can't seem to get sed(1) to print lines 110 through 115 of > a file. It seems the most basic of things, but sed(1) insists on > printing the whole file, no matter what I do... sed -n 110,115p <file Unless you say -n, sed prints every line. That's because sed is so often used to transform every line of a file the same way. -- --Andrew Koenig ark@europa.att.com
jik@athena.mit.edu (Jonathan I. Kamens) (05/15/89)
In article <2859@buengc.BU.EDU> bph@buengc.bu.edu (Blair P. Houghton) writes: >In that vein, I've R'ed TMFM, and I've twiddled the permutations, but >I just can't seem to get sed(1) to print lines 110 through 115 of >a file. It seems the most basic of things, but sed(1) insists on >printing the whole file, no matter what I do... The key here is that sed(1) will always print its input lines to the standard output unless you tell it not to, so what you have to do is tell it to delete everything *except* for the lines you want to print. This should work: sed '110,115 !d' <filename> Of course, you'll have to quote the ! with a backslash if you use csh (and possibly ksh, although I'm not sure). Jonathan Kamens USnail: MIT Project Athena 410 Memorial Drive, No. 223F jik@Athena.MIT.EDU Cambridge, MA 02139-4318 Office: 617-253-4261 Home: 617-225-8218
dwn@swbatl.UUCP (4007) (05/15/89)
In article <2859@buengc.BU.EDU> bph@buengc.bu.edu (Blair P. Houghton) writes: > >In that vein, I've R'ed TMFM, and I've twiddled the permutations, but >I just can't seem to get sed(1) to print lines 110 through 115 of >a file. It seems the most basic of things, but sed(1) insists on >printing the whole file, no matter what I do... > >What is the proper one-liner syntax for that? > sed -n '110,115p' file It's the "-n" option that tells sed to print nothing but lines explicitly selected, or as TFM says, "The -n option suppresses the default output." -- David Neill office -> 405-278-4007 -> swbatl!oktext!mktco Mgr - Mktg.(SWBTCo) home -> 405-749-1141 -> swbatl!oktext!frodo!david
morrell@hpsal2.HP.COM (Michael Morrell) (05/16/89)
/ hpsal2:comp.unix.questions / bph@buengc.BU.EDU (Blair P. Houghton) / 5:27 am May 14, 1989 / In that vein, I've R'ed TMFM, and I've twiddled the permutations, but I just can't seem to get sed(1) to print lines 110 through 115 of a file. It seems the most basic of things, but sed(1) insists on printing the whole file, no matter what I do... What is the proper one-liner syntax for that? ---------- Try "sed -n 110,115p".