Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!bloom-beacon!eru!hagbard!sunic!erbe.se!prc From: prc@erbe.se (Robert Claeson) Newsgroups: comp.unix.questions Subject: Re: getting a field from a line in awk/sed/? Message-ID: <1991Jan15.134416.27225@erbe.se> Date: 15 Jan 91 13:44:16 GMT References: <1991Jan9.162817.17038@porthos.cc.bellcore.com> <1991Jan10.012211.22100@ux1.cso.uiuc.edu> Sender: prc@erbe.se (Robert Claeson) Reply-To: prc@erbe.se (Robert Claeson) Organization: ERBE DATA AB, Jakobsberg, Sweden Lines: 20 In article <1991Jan10.012211.22100@ux1.cso.uiuc.edu>, gordon@osiris.cso.uiuc.edu (John Gordon) writes: |> Well, this may not be perfect since I don't have an AWK reference |> right here, but I think this will work: |> |> (program that produces output) | awk '{print $2}' |> If that does not work, try this: |> |> awk -f '{print $2}' The former should work. The latter doesn't work. The -f flag to awk names a file containing awk code to execute. But using "cut" is even easier (and requires less typing) than using "awk". -- Robert Claeson |Reasonable mailers: rclaeson@erbe.se ERBE DATA AB | Dumb mailers: rclaeson%erbe.se@sunet.se Jakobsberg, Sweden | Perverse mailers: rclaeson%erbe.se@encore.com Any opinions expressed herein definitely belongs to me and not to my employer.