I have a set of csv files, one of them has a timestamp, all the other ones just have data, but they all have the same number of rows.
I would like to append the timestamp to all csv files. This is currently working but instead of writing new files with out_ in front of the name, I would simply want to overwrite the original files. If I only use $file then I only get the timestamp and not the data from the files.
#!/bin/bash
for file in *.csv;
do
awk -F, -v var="$file" '{getline f1 < var ;print $2, f1}' OFS=, timestamp.csv > out_$file
done