I don't like using the last argument in awk.
Having that said
awk -v text=$1 -v RS="\n\n" '$2 == text {print }' < text.txt
Thanks for the tips folks. I'll have to have another read at el ol awk
manual.
On 5/2/06, Colm MacCarthaigh <colm at stdlib.net> wrote:
>> On Tue, May 02, 2006 at 08:05:41PM +0100, Paul Jakma wrote:
> > cat text.txt |awk -v text=$1 '$2 == text {print $4}' RS="\n\n"
> >
> > -v is a standard AWK feature.
>> So is taking a file as the last argument. For crying out loud people,
> think of the pipe carnage!
>> --
> Colm MacCárthaigh Public Key: colm+pgp at stdlib.net> --
> Irish Linux Users' Group mailing list
> About this list : http://mail.linux.ie/mailman/listinfo/ilug> Who we are : http://www.linux.ie/> Where we are : http://www.linux.ie/map/>
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!