Substitute CSV Column Values Plus One With awk
September15
Suppose you have a three column data csv file that the values of one column, the third par example, must be substituted with current value plus one. This is very easy to do using awk.
Just type:
1 | awk -F, '{$3++; print $1","$2","$3}' input-file.csv |
awk will print by default the result to the console. To save the result you should output it to a file using:
1 | awk -F, '{$3++; print $1","$2","$3}' input-file.csv > output-file.csv |
The third column of the output file contains the input file values plus one.