13

awk variable regexp works in AIX but not in SunOS?

view full story
linux-howto

http://www.unix.com – Using awk variables for regular expressions is working for me in AIX. It is failing for me in SunOS. I don't know why. Can someone explain and/or suggest a fix for the SunOS version? Here is a little test script. It runs fine in AIX: Code: $ cat test.ksh #! /bin/ksh print "Executed on OS: $( uname -rsv )" > test.out ( echo "line 1"; echo "middle line"; echo "last one" ) | awk '   BEGIN {     re="iddl"   }   $0 ~ re {     print "From awk: " $0   } ' >> test.out 2>&1 $ ./t (HowTos)