I have a variable (that contains multiple lines of text) that I'm modifying using awk to replace the whitespace between fields with a comma and I'm trying to save it to another variable. This is what I'm doing at the moment:
VAR2=$(echo "$VAR1" | awk 'END {OFS=","}' 1)
However when I do echo "$VAR2"
, it prints nothing but an empty line.