0

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

2
Contributors
2
Replies
3
Views
10 Years
Discussion Span
Last Post by ranj@chn
0

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

0

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.