I have a text file with the following dates in the format dd/mm/yyyy:
14/09/1992
15/04/1983
15/09/1961
02/06/1979
14/12/1971
08/02/2001
19/06/1999
14/09/1969
31/08/2002
30/07/1980
25/04/1973
03/01/1992
I want to convert this into the YYYY/mm/dd format in a script. I was planning to use the date command to do so:
date -f tempDate +%Y/%m/%d
but the thing is, it does not recognize the English-style dates and shows the following error as i believe it is reading it as mm/dd/yyyy when i don’t want it to:
date: invalid date `14/09/1992'
is there another way of doing this? or is there a way i can change the order of the date format?
also, I need this script to work on a server that I am not a sysadmin for.
If the file is as described why not just reverse the columns with
awk:Edit:
Just as easy in
awkwith multiple field separator: