OFS - Output Field Separator in UNIX

OFS is a AWK built-in variable used to change the output field separator.

Exmple Usage : OFS can be used to convert space separated file into colon separated file

file.txt contains
sam 80
merlin 90
ray 85


awk 'BEGIN{OFS=":";}{print $1,$2;}' file.txt


Output
sam:80
merlin:90
ray:85


Note : OFS will not be applied when print $1 $2 is used , is mandatory and OFS will not be used if print $0 is used.