DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/)
-   Shell Scripting (http://www.daniweb.com/forums/forum113.html)
-   -   searching for a record in a file (http://www.daniweb.com/forums/thread123648.html)

vinz4ever May 11th, 2008 5:55 am
searching for a record in a file
 
can pliz someone help, m trying to serach and display a record in shell scripting in linux

i have one data file n one source file. wat should write in the source[coding] file to to search for a record acording to a search pattern entered by a user...

the data file is like

9009709 Deo Vinit V IT Programmer 17/03/08
9207700 Benny Benson N HR Manager 20/06/07
..
..
............

wat should i write in my source file so that say user wants to search for record with number as 9009709 n then display the entire record for that number on the screen

i tried using awk n grep n sed but got confused....

pliz can someone help.....

Salem May 11th, 2008 7:29 am
Re: searching for a record in a file
 
awk '$1==9009709' file.txt


All times are GMT -4. The time now is 8:21 am.

Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC