04-28-2009, 04:02 PM
Can anyone help a scripting Noobie with shell script I'm trying to compile?
He wants to create a script which is basically an address book, all his data in in a text file (I think its in csv format, so we'll assusme it is).
He basically wants to enter the contacts surname (which is the data in the 1st culumn of the file) and he wants the script then to check to see if the 2nd column says either 'Business' or 'Personal' and then echo the fields in the remaining coulumns depending what was fould in column 2, so for example if 'Jones' was inputted and column 2 said 'Personal' the output would be:
Mobile Number: 07000 000 000
Address: 2 Any Street, Anytown, Anyshire, AN1 2AN
But if column 2 said 'Business' it would be:
Business Number: 07000 000 000
Business Email: ben.jones(at)company.com
Business Address: 2 Any Street, Anytown, Anyshire, AN1 2AN
I'm guessing awk or grep (or both) must be used?
Any help would be gratefully appreciated