I have several csv table as follow:
YEAR;MONTH;DAY;RES1;RES2
1971;1;1;1206.1;627
1971;1;2;1303.4;654.3
1971;1;3;1248.9;662
1971;1;4;1188.8;666.8
Run Code Online (Sandbox Code Playgroud)
From this I would like to create a new column that concatenate the values of the columns MONTH and DAY. Therefore the output should look like that:
YEAR;MONTH;DAY;RES1;RES2;MONTHDAY
1971;1;1;1206.1;627;11
1971;1;2;1303.4;654.3;12
1971;1;3;1248.9;662;13
1971;1;4;1188.8;666.8;14
Run Code Online (Sandbox Code Playgroud)
Since you're happy for the header line to also be merged this is simple awk
awk -F';' -vOFS=';' '{ $(NF+1)=$2$3 ; print}'
Run Code Online (Sandbox Code Playgroud)
Basically we add a new field $(NF+1) which consists of $2$3, which merges those fields. With OFS=';' the fields are output with ; separator.