I would like to manipulate string with awk.
Now to see current record on awk i’m using $0 and this works fine:
echo "foobar" | awk -v FS="" '{print $0 }'
my output is
foobar
Now I would like to replace my second character with 5th character:
echo "foobar" | awk -v FS="" '{$2=$5; print $0 }'
It works, but it adds space after each character:
f a o b a r
So my question is why awk add space after each character and how to so it right?
Set OFS(Output field separator) to empty: