1
# Translate this shell script into gawk:
7
# echo a:b:c | $AWK -F":" '{$2="x"; OFS=FS; print}'
8
# echo a:b:c | $AWK -F":" '{$2="x"; print; OFS=FS; print}'
9
# echo a:b:c | $AWK -F":" '{$2="x"; print $1; OFS=FS; print}'
10
# echo a:b:c | $AWK -F":" '{$2="x"; print; $2=$2; OFS=FS; print}'
18
# Have to reset OFS at end since not running separate invocations
20
FNR == 1 { $2 = "x"; OFS = FS; print ; OFS = " "}
21
FNR == 2 { $2 = "x"; print; OFS = FS; print ; OFS = " "}
22
FNR == 3 { $2 = "x"; print $1; OFS = FS; print ; OFS = " "}
23
FNR == 4 { $2 = "x"; print; $2 = $2; OFS = FS; print }