168,1331122362,412482,,111,,3654
I have the above csv, the second column being a timestamp. I need to convert that timestamp to datetime format which i'm using the following awk statement:
awk -i inplace -F"," '{OFS=","; $2=strftime("%Y-%m-%d %H:%M:%S", $2);}' file.csv
If I remove the inplace option and add a 'print$0' it works as I expect it to work but when doing it with the inplace option it just empties my csv file. I have been looking around and haven't found anyone with similar problems so i'm assuming there is something wrong with my statement but I can't figure out what it is. Probably since i'm not familiar with awk/sed at all.
$AWKPATH
not to include.
or make sure you run that command from within a working directory where nobody could create a file calledinplace
orinplace.awk
. – Stéphane Chazelas Jun 24 '23 at 21:13