I'm automating some data that gets generated in .csv format and I'm stuck when it comes to formatting the fields with data values. Kindly help me with this.
I have the following data in a .csv file:
April 3 2016 FL 03112017 0
April 4 2016 CA 04022016 0
April 5 2016 TX 04302016 0
April 6 2016 OH 05292016 0
April 7 2016 AZ 06092016 0
April 8 2016 MA 06252016 0
I would like to create the file as follow:
2016-04-03 FL 03112017 0
2016-04-04 CA 04022016 0
2016-04-05 TX 04302016 0
2016-04-06 OH 05292016 0
2016-04-07 AZ 06092016 0
2016-04-08 MA 06252016 0
I have tried it using awk, with something like this:
awk -F "\t" '{print "date -d "$1" +'%Y-%m-%d'",$2,$3}' file.csv > file1.txt
That doesn't work. I'm not able to assign a resultant/calculated value to the $1 that has to be printed.