LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG] Little code, please

[ILUG] Little code, please

Rory Browne rory.browne at gmail.com
Tue May 2 20:35:38 IST 2006


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/
>



More information about the ILUG mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


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!
RSS Version
Powered by Dell