Find the answer to your Linux question:
Results 1 to 4 of 4
Hey guys, I've been lurking here for the past few days and have been helped massively by the posts here. So, firstly, a huge thank you for that. However, I'm ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Dec 2011
    Posts
    5

    Question [BASH] Get person's age based from date of birth from .csv file


    Hey guys, I've been lurking here for the past few days and have been helped massively by the posts here. So, firstly, a huge thank you for that.

    However, I'm stuck on a particular problem and require some 1 -to-1 assistance.

    I have a file called details.csv which holds 3 basic details about a person: their age, phone number and date of birth (in dd/mm/yyyy format).

    These details are entered via the standard input:
    read -p "Name: " name
    read -p "Number: " number
    etc

    and then placed in the details.csv.

    details.csv in then sorted into date-of-birth order.

    So, say I have the following information in the csv file.

    fred,999,03/04/2005
    jane,888,01/01/1993
    james,3456,12/01/1987
    john,1234,11/08/1955

    How can I get and display the age of all four people based on today's date?

    Thank you for your time.

  2. #2
    Super Moderator Roxoff's Avatar
    Join Date
    Aug 2005
    Location
    Nottingham, England
    Posts
    3,846
    Hi, welcome to the forums. I'm sure you're aware that the forum rules are very specific about asking homework questions here.

    I'm sure if you had an attempt at this yourself then asked for comments on a solution, or if you posted the specific problem you encountered when you tried to form your solution, we'd be able to help.

    All I will say for now is that you should look at the man page for the 'date' command.
    Linux user #126863 - see http://linuxcounter.net/

  3. #3
    Just Joined!
    Join Date
    Dec 2011
    Posts
    5
    Quote Originally Posted by Roxoff View Post
    Hi, welcome to the forums. I'm sure you're aware that the forum rules are very specific about asking homework questions here.

    I'm sure if you had an attempt at this yourself then asked for comments on a solution, or if you posted the specific problem you encountered when you tried to form your solution, we'd be able to help.

    All I will say for now is that you should look at the man page for the 'date' command.

    I wish I was at school instead of wasting my life

    I'm following some exercises I found online in order to try and teach myself, but this one doesn't have a solution to help guide.

    Anyway, you'll be pleased to know that I cracked it a couple of hours ago and I no longer need any assistance.

    Thanks anyway.

  4. #4
    Super Moderator Roxoff's Avatar
    Join Date
    Aug 2005
    Location
    Nottingham, England
    Posts
    3,846
    Quote Originally Posted by DietFlosser View Post
    I wish I was at school instead of wasting my life

    I'm following some exercises I found online in order to try and teach myself, but this one doesn't have a solution to help guide.

    Anyway, you'll be pleased to know that I cracked it a couple of hours ago and I no longer need any assistance.

    Thanks anyway.
    Well done in solving this. Even though it wasn't truly a homework question, it was an abstract question from academia (they're pretty easy to spot), and you probably learned much more by digging out the knowledge you needed from the source material rather than having someone hand you a pre-formed answer on here.

    Don't be afraid to ask more questions as you continue to learn. There's usually plenty of people willing to help if you post "I have this question, here's my answer but it's not working, can anyone help" rather than "I have this question can someone answer it for me".
    Linux user #126863 - see http://linuxcounter.net/

Posting Permissions

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