oawk is "old awk", it is the default /usr/bin/awk on Solaris and should not be used. You can also find it in [[http://heirloom.sourceforge.net/tools.html|The Heirloom Toolchest]] Here are some reason why it's called "old" [[https://groups.google.com/group/comp.lang.awk/browse_thread/thread/0203ec80e5a9feda#|taken from this post by Ed Morton]], if you have more please reply to the above thread and/or edit this page. <toc> ==== no conditions without explicit comparisons: {{{sh $ echo "foo" | /usr/xpg4/bin/awk '1{print}' foo $ echo "foo" | /usr/bin/awk '1==1{print}' foo $ echo "foo" | /usr/bin/awk '1{print}' awk: syntax error near line 1 awk: bailing out near line 1 $ echo "foo" | /usr/bin/awk '1==1{print}' foo $ echo "foo" | /usr/xpg4/bin/awk '!x{print}' foo $ echo "foo" | /usr/bin/awk '!x{print}' awk: syntax error near line 1 awk: bailing out near line 1 foo $ echo "foo" | /usr/bin/awk 'x!=0{print}' foo }}} ==== no ternary expressions: {{{sh $ echo "foo" | /usr/xpg4/bin/awk '{print ($0=="foo") ? "yes" : "no"}' yes $ echo "foo" | /usr/bin/awk '{print ($0=="foo") ? "yes" : "no"}' awk: syntax error near line 1 awk: illegal statement near line 1 }}} ==== no ARGC: {{{sh $ echo "foo" | /usr/xpg4/bin/awk '{print "<"ARGC">"}' <1> $ echo "foo" | /usr/bin/awk '{print "<"ARGC">"}' <> }}} ==== no sub()/gsub(): {{{sh $ echo "foo" | /usr/xpg4/bin/awk '{print "<" sub(/o/,"X") ">"}' <1> $ echo "foo" | /usr/bin/awk '{print "<" sub(/o/,"X") ">"}' awk: syntax error near line 1 awk: illegal statement near line 1 }}} ==== no -v: {{{sh $ echo "foo" | /usr/xpg4/bin/awk -v var="X" '{print "<" $0,var ">"}' <foo X> $ echo "foo" | /usr/bin/awk -v var="X" '{print "<" $0,var ">"}' awk: syntax error near line 1 awk: bailing out near line 1 }}} ==== inexplicable parameter parsing (here thinks "<bar>" is arg to sprintf()): {{{sh $ echo "foo" | /usr/xpg4/bin/awk '{print sprintf("%s =",$0), "<bar>"}' foo = <bar> $ echo "foo" | /usr/bin/awk '{print sprintf("%s =",$0), "<bar>"}' foo = }}} ==== no functions: {{{sh $ echo "foo" | /usr/xpg4/bin/awk 'function bar(){print} {bar()}' foo $ echo "foo" | /usr/bin/awk 'function bar(){print} {bar()}' awk: syntax error near line 1 awk: bailing out near line 1 }}} ==== no dynamic REs: {{{sh $ echo "foo" | /usr/xpg4/bin/awk 'BEGIN{re="o"} $0 ~ re {print}' foo $ echo "foo" | /usr/bin/awk 'BEGIN{re="o"} $0 ~ re {print}' awk: syntax error near line 1 awk: bailing out near line 1 }}} ==== Hangs if no input and no explicit exit: {{{sh $ time /usr/xpg4/bin/awk 'BEGIN{print "begin"}' begin real 0m0.06s user 0m0.01s sys 0m0.02s $ time /usr/bin/awk 'BEGIN{print "begin"}' begin ^?$ }}} ==== Can't delete an array element: {{{sh $ /usr/xpg4/bin/awk 'BEGIN{ a[1]=a[2]; delete a[1]; for (i in a) print i; exit }' 2 $ /usr/bin/awk 'BEGIN{ a[1]=a[2]; delete a[1]; for (i in a) print i; exit }' 2 1 }}} ==== Can't test for an element being "in" an array: {{{sh $ /usr/xpg4/bin/awk 'BEGIN{ a[1]=7; if (1 in a) print a[1]; exit }' 7 $ /usr/bin/awk 'BEGIN{ a[1]=7; if (1 in a) print a[1]; exit }' awk: syntax error near line 1 awk: illegal statement near line 1 }}} ==== No FNR variable: {{{sh $ cat file1 a $ cat file2 b $ /usr/xpg4/bin/awk 'NR==FNR{print}' file1 file2 a $ /usr/bin/awk 'NR==FNR{print}' file1 file2 }}} ==== No match() function: {{{sh $ /usr/xpg4/bin/awk '{print match($0,"a")}' file1 file2 1 0 $ /usr/bin/awk '{print match($0,"a")}' file1 file2 awk: syntax error near line 1 awk: illegal statement near line 1 }}} ==== FS cannot be an RE: {{{sh $ echo "faobo" | /usr/xpg4/bin/awk '{ print $1,$2,$3 }' FS="[ab]" f o o $ echo "faobo" | /usr/bin/awk '{ print $1,$2,$3 }' FS="[ab]" faobo }}} ==== Cannot set $0: {{{sh $ /usr/xpg4/bin/awk 'BEGIN{$0="foo"; print}' foo $ /usr/bin/awk 'BEGIN{$0="foo"; print}' awk: can't set $0 }}} ==== Strings can unexpectedly become numeric variables: {{{sh $ /usr/xpg4/bin/awk 'BEGIN{ c=3; print "c=" ++c; exit }' c=4 $ /usr/bin/awk 'BEGIN{ c=3; print "c=" ++c; exit }' 03 $ /usr/xpg4/bin/awk 'BEGIN{ c=3; print "c=" ++c; print ++"c=" c; exit }' /usr/xpg4/bin/awk: syntax error Context is: >>> BEGIN{ c=3; print "c=" ++c; print ++"c=" <<< $ /usr/bin/awk 'BEGIN{ c=3; print "c=" ++c; print ++"c=" c; exit }' 03 23 }}}
Summary:
This change is a minor edit.
Username: