Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!natinst!sequoia!painter From: painter@sequoia.execu.com (Tom Painter) Newsgroups: comp.unix.questions Subject: Re: getting a field from a line in awk/sed/? Message-ID: <30644@sequoia.execu.com> Date: 15 Jan 91 02:13:29 GMT References: <1991Jan9.162817.17038@porthos.cc.bellcore.com> <1991Jan9.225344.19979@informix.com> <5155@idunno.Princeton.EDU> Organization: Execucom Systems Lines: 28 In article <5155@idunno.Princeton.EDU> pfalstad@phoenix.Princeton.EDU (Paul John Falstad) writes: >In article <1991Jan9.225344.19979@informix.com> dberg@informix.com (David I. Berg) writes: >>Use cut. The syntax is ` cut -fn -d" " ', where n is the number of the >>field you wish to extract. -d" " specifies spaces as the delimiter between >>fields. `man cut' will give you all the particulars. > >That isn't going to work for his example (output of lpq). Use the specific columns option to 'cut' cut -c8-15 filename or lpq | cut -c8-15 which will cut out columns 8 through 15. (Note: 'cut' and its companion 'paste' are Sys V tools. Some BSD versions do have them. You might look for an AT&T (att) bin on your system.) Tom -- ----------------------------------------------------------------------------- Tom Painter UUCP: ...!cs.utexas.edu!execu!painter Execucom Systems Corp., Austin, Texas Internet: painter@execu.com (512) 327-7070 execu!painter@cs.utexas.edu Disclaimer: My Company? They'll claim all my waking hours, not my opinions. -----------------------------------------------------------------------------