Output Separators

Change output field separator to comma
printf 'nginx 4821 active\npostgres 1337 active\nredis 982 stopped\n' | awk -v OFS=',' '{$1=$1; print}'
Tab-delimited output from whitespace input
cat <<'EOF' > /tmp/messy_spaces.txt
web-proxy-01    87.3    62.1
db-primary   34.8     91.4
cache-redis      12.5  28.7
EOF
awk -v OFS='\t' '{$1=$1; print}' /tmp/messy_spaces.txt
Semicolon between output records
printf 'nginx\npostgres\nredis\nhaproxy\n' | awk 'BEGIN{ORS="; "} {print $1}'
Paragraph mode — blank lines as record separators
cat <<'EOF' > /tmp/paragraphs.txt
Host: web-proxy-01
Status: active
Uptime: 47d

Host: db-primary
Status: degraded
Uptime: 12d

Host: cache-redis
Status: active
Uptime: 89d
EOF
awk -v RS='' -v ORS='\n---\n' '{print NR": "$0}' /tmp/paragraphs.txt
Multi-character record separator — blocks delimited by "%%"
cat <<'EOF' > /tmp/data.txt
nginx: reverse proxy
port: 443
%%
postgres: database
port: 5432
%%
redis: cache layer
port: 6379
EOF
awk 'BEGIN{RS="%%"; FS="\n"} NF>1{print "Block " NR": " $1}' /tmp/data.txt
CSV to TSV conversion
printf 'hostname,cpu,mem\nweb-proxy-01,87.3,62.1\ndb-primary,34.8,91.4\n' | awk -F',' '{$1=$1} OFS="\t"'
Colon-delimited to pipe-delimited
awk -F':' 'BEGIN{OFS="|"} {$1=$1; print}' /etc/passwd
Reformat /etc/passwd as CSV
awk 'BEGIN{FS=":"; OFS=","} {print $1,$3,$6}' /etc/passwd