Specify output separator character

This commit is contained in:
Cedric Dufour 2015-09-04 10:12:46 +02:00
parent 4c2d0d2d8e
commit 8f0d2e9fc3
1 changed files with 3 additions and 0 deletions

View File

@ -6,3 +6,6 @@ printf '1:2:3' | awk -F ":" '{print $1+$2+$3}'
# print a multiplication table # print a multiplication table
seq 9 | sed 'H;g' | awk -v RS='' '{for(i=1;i<=NF;i++)printf("%dx%d=%d%s", i, NR, i*NR, i==NR?"\n":"\t")}' seq 9 | sed 'H;g' | awk -v RS='' '{for(i=1;i<=NF;i++)printf("%dx%d=%d%s", i, NR, i*NR, i==NR?"\n":"\t")}'
# Specify output separator character
printf '1 2 3' | awk 'BEGIN {OFS=":"}; {print $1,$2,$3}'