I am making a bash script contact list system. This is what it prints out.
=================
Menu
=================
Enter 1 for Insert new contact
Enter 2 for Print current contact list
Enter 3 for Search contact list
Enter 4 for Exit
Enter your selection:
For "1" it ask for name, email, and phone and stores them for variables then stores them in a text file.
case "$answer" in
1) echo -e "Enter in a new contact name: \c"
read name
echo -e "Enter in new contact email address: \c"
read email
echo -e "Enter in new contact phone number: \c"
read phone
echo "$name, $email, $phone" >> contacts.txt ;;
For 2 is where I am having trouble. I want to display the text in three columns so I can sort them by name, email, or phone number. This is my code for case 2.
2) cat contacts.txt ;;
Obviously it only spits out:
Test Name, [email protected], 123-123-1234
Blank Data, [email protected], 234-555-5555
I want it to read:
Name Email Phone
Test Name [email protected] 123-123-1234
Blank Data [email protected] 234-555-5555
How would I do that? And how would I be able to sort it later on?