Print all Fields with AWK separated by OFS
This is a variation on the first style: echo “1 2 3 4″ | gawk ‘BEGIN { OFS=” 🙁 “}; {$1=$1; print $0}’ Results: 1 🙁 2 🙁 3 🙁 4 Explanation: the $1=$1 is to rebuild the record, using the current OFS (you can also see http://www.gnu.org/software/gawk/manual/gawk.html#Changing-Fields) Update: (suggested by @EdMorton and @steve) This … Read more