The Sed/Grep command is really confusing me. I know I'm missing something that should be really easy to fix. My program displays multiple names after I ask it to display only one, How do I get it to do only one??
it looks like this:
Please enter a name to display?
>> John
(A list then appears)
1. John Doe
2. John Smith
3. John James
Please enter the record that you would like to display on separate page?
>> 3
And then John James should appear on a separate page like this
3.
John James
1234 Main Street
City, State, Zipcode
Telephone Number
However, my program displays every John
_________
my code looks like this:
echo "Please enter a name to display \c"
read name
#Displays all of the names with their record number
grep -in $name phonebook
#Enter the record number to display on separate page
echo "Enter the record number of the name you want to display \c"
read number
record=`grep -i $number phonebook` (I'm Pretty sure this is the error)
clear
grep -in "$name" phonebook | sed -n -e 's/^/\
/' -e 's/:/\
/gp'