--- プログラム ---
BEGIN{
print 123
print "a,b,c"
print
print "a","b","c"
print "a" "b" "c"
print
p=1;q=2;
print p+q
print p,q
print p q
print
printf "ab"
printf "cd" "ef"
print
print
printf "%5d\n",123
printf "%5d\n",1234
printf "%5d\n",12345
print
printf "%8.2f\n",123.1
printf "%8.2f\n",1234.12
printf "%8.2f\n",12345.123
print
print "a","b","c"
OFS=","
print "a","b","c"
}
--- 実行結果 ---
123
a,b,c
a b c
abc
3
1 2
12
abcdef
123
1234
12345
123.10
1234.12
12345.12
a b c
a,b,c
++ MEMO ++
OFSはAWKのビルトイン変数で、出力時の区切り文字を指定する。
デフォルトはスペース(" ")。
戻る