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

Niall O Broin niall at linux.ie
Tue May 2 19:34:04 IST 2006


On 2 May 2006, at 18:25, Timothy Murphy wrote:

> Talking of scripts, could you please tell me
> the simplest script to search through "refer-like" files
> with items separated by a blank line, eg
>
> %n Tom
> %t 3
>
> %n Peter
> %t 17
>
> I'd like a script (in any known language), say "foo", so that
> "foo Tom" would print out
>
> %n Tom
> %t 3

Well, so far we've had offers in perl, and a combo. of awk & shell,  
but for the life of me, unless there's something Tim hasn't told us  
(in which case presumably the other offers will also be wrong), I  
don't see why anything more than

grep -A 1 Tom FILE

is needed.



Niall




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