Dhruuv Dhruuv - 6 months ago 9
Linux Question

Is it possible to add an empty column with no values in the beginning of a .CSV file?

How do I add an empty column at the beginning of a .CSV file using

awk
? I am trying the following code, but that doesn't help.

awk '{",",print $0}' file1.csv > file2.csv


Please help...

Answer

Another awk

awk '{print ","$0}' file1.csv > file2.csv

or

awk '{$0=","$0}1' file1.csv > file2.csv
Comments