Sunday 11 December 2011

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

[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.

No comments:

Post a Comment