944,098 Members | Top Members by Rank

Ad:
Apr 25th, 2006
0

doing a lookup script

Expand Post »
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
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
gatormike53 is offline Offline
4 posts
since Apr 2006
Apr 26th, 2006
0

Re: doing a lookup script

Quote 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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
gatormike53 is offline Offline
4 posts
since Apr 2006
Apr 29th, 2006
0

Re: doing a lookup script

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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
ranj@chn is offline Offline
4 posts
since Apr 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Shell Scripting Forum Timeline: searching for files
Next Thread in Shell Scripting Forum Timeline: need help with $PATH





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC