User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Shell Scripting section within the Software Development category of DaniWeb, a massive community of 427,101 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,181 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Shell Scripting advertiser: Programming Forums
Views: 394 | Replies: 1
Reply
Join Date: May 2008
Posts: 1
Reputation: vinz4ever is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
vinz4ever vinz4ever is offline Offline
Newbie Poster

searching for a record in a file

  #1  
May 11th, 2008
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.....
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Dec 2005
Posts: 3,639
Reputation: Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of 
Rep Power: 22
Solved Threads: 418
Colleague
Salem's Avatar
Salem Salem is offline Offline
void main'ers are DOOMed

Re: searching for a record in a file

  #2  
May 11th, 2008
awk '$1==9009709' file.txt
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
Do not PM me for help; You'll be ignored, or told to learn to read.
Do not ask me if I'm muslim - I'm not. Nor do I care about yours or anyone else's mysticism. Religion is a matrix, take the RED PILL.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb Shell Scripting Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the Shell Scripting Forum

All times are GMT -4. The time now is 5:40 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC