doing a lookup script

Reply

Join Date: Apr 2006
Posts: 4
Reputation: gatormike53 is an unknown quantity at this point 
Solved Threads: 0
gatormike53 gatormike53 is offline Offline
Newbie Poster

doing a lookup script

 
0
  #1
Apr 25th, 2006
New to Linux and need the credit for my class to ensure a good grade but not sure on the cmd line to finish
I have created a data file called ".addr_book" in home directory plus a 'bin" directory . NOW this is what I am unsure of

I need to create a file called "lookup" (shell script) in the bin directory that when run should find matching entries (lines) from my $HOME/.addr_book file and display them. The output must be sorted using grep, sort and postional parameters but NOT read.. Can anyone help? Thanks in advance
Reply With Quote Quick reply to this message  
Join Date: Apr 2006
Posts: 4
Reputation: gatormike53 is an unknown quantity at this point 
Solved Threads: 0
gatormike53 gatormike53 is offline Offline
Newbie Poster

Re: doing a lookup script

 
0
  #2
Apr 26th, 2006
Originally Posted by gatormike53
New to Linux and need the credit for my class to ensure a good grade but not sure on the cmd line to finish
I have created a data file called ".addr_book" in home directory plus a 'bin" directory . NOW this is what I am unsure of

I need to create a file called "lookup" (shell script) in the bin directory that when run should find matching entries (lines) from my $HOME/.addr_book file and display them. The output must be sorted using grep, sort and postional parameters but NOT read.. Can anyone help? Thanks in advance
ADD ON: ok I think this is part of what I will place in the "look up" file but still need help with the positional parameters and if I need a sort option or just sort, please!
grep "Name" .addr_book |
ok from here I'm a little lost , how would sort work after the pipeline and the positional parameters. I figure if I can get the cmd right I can create the "look up" file in vi and place it there
Reply With Quote Quick reply to this message  
Join Date: Apr 2006
Posts: 4
Reputation: ranj@chn is an unknown quantity at this point 
Solved Threads: 0
ranj@chn ranj@chn is offline Offline
Newbie Poster

Re: doing a lookup script

 
0
  #3
Apr 29th, 2006
Check the -k option of sort. That should help. (eg) if you want to sort based on 2'nd field,
ls -rlt | sort -k2

ALways check man sort. It mostly gives the best solution.

Regards,
Ranjith
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC