I've got a csv file with this content:
col1, col2, col5
1, 1, 1
2, 2, 2
3, 3, 3
4, 4, 4
I need to add a column in the third position of the file with a header but with empty values.
col1, col2, col3, col4
1, 1, , 1
2, 2, , 2
3, 3, , 3
4, 4, , 4
Is there any way to do it using one of the Linux commands like cat, sed, awk or cut?
I know that with cut is possible to modify a file by columns cut -d , -f1,2,3 file1 > file2
. But it seems does not have the option to add a custom column.
Any help would be much appreciated.
,
s in the file?