Find the answer to your Linux question:
Results 1 to 3 of 3
Can anyone help with a request I have from a friend (who isn't online)? He wants to create a script which is basically an address book, all his data in ...
  1. #1
    Just Joined!
    Join Date
    Oct 2008
    Location
    Edinburgh, Scotland
    Posts
    18

    Smile Shell Script for Address book

    Can anyone help with a request I have from a friend (who isn't online)?

    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:

    Code:
    Surname:  Jones
    Forename: Ben
    Birthday: 03/09
    Mobile Number: 07000 000 000
    Email: ben.jones(at)email.com
    Address: 2 Any Street, Anytown, Anyshire, AN1 2AN
    but if column 2 said 'Business' it would be:

    Code:
    Surname:  Jones
    Forename: Ben
    Position: Manager
    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

  2. #2
    Just Joined!
    Join Date
    Apr 2009
    Posts
    90
    SQL would be best i suppose. And MySQL CAN work with CSV files.

    You could do a nice SQL query then?

  3. #3
    Just Joined!
    Join Date
    Oct 2008
    Location
    Edinburgh, Scotland
    Posts
    18

    Cool

    Quote Originally Posted by Touchtecservers View Post
    SQL would be best i suppose. And MySQL CAN work with CSV files.

    You could do a nice SQL query then?
    I've absolutely no experience of SQL at all!

    Does anyone know how to do this using plain ol' Shell Script?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...