awk - show field separator

I am using this code to insert something into a csv file:

awk -F";" -v url=$url -v nr=$nr 'NR==nr{$2=url$2}1' file

Why do I get the output

field1 field2

instead of

field1;field2

I have given

-F";"

, so the field separator should surely be ";".

-F is just the input field separator. The output field separator is controlled by the special variable OFS.

awk '{ ... }' OFS=";" filename
1 Like