Hi,
My objective is to achieve from HB.txt
05/20/1997,1130,5.93,5.96,5.93,5.96,49200
05/20/1997,1131,5.96,5.96,5.9,5.93,252400
05/14/1997,1132,5.93,5.99,5.93,5.99,89600
05/15/1997,1133,5.93,5.93,5.71,5.74,203200
into adding a day column by using the first column - date.
05/14/1997,1132,5.93,5.99,5.93,5.99,89600,Wed
05/15/1997,1133,5.93,5.93,5.71,5.74,203200,Thu
05/20/1997,1130,5.93,5.96,5.93,5.96,49200,Tue
05/20/1997,1131,5.96,5.96,5.9,5.93,252400,Tue
So far, I'm in progress to try this,
awk 'BEGIN{RS="\r"; FS=",";}{printf $0 "," $1;}' HB.txt > newHB.csv
However, the generated output for the new column is after a breakline.
05/14/1997,1132,5.93,5.99,5.93,5.99,89600,05/14/1997
05/15/1997,1133,5.93,5.93,5.71,5.74,203200
05/20/1997,1130,5.93,5.96,5.93,5.96,49200,
05/15/1997
05/20/1997,1131,5.96,5.96,5.9,5.93,252400,
05/20/1997
System Specifications:
macOS High Sierra
Terminal - Bash