getting a field from a line in awk/sed/?
Tom Painter
painter at sequoia.execu.com
Tue Jan 15 13:13:29 AEST 1991
In article <5155 at idunno.Princeton.EDU> pfalstad at phoenix.Princeton.EDU (Paul John Falstad) writes:
>In article <1991Jan9.225344.19979 at informix.com> dberg at 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 at execu.com
(512) 327-7070 execu!painter at cs.utexas.edu
Disclaimer: My Company? They'll claim all my waking hours, not my opinions.
-----------------------------------------------------------------------------
More information about the Comp.unix.questions
mailing list