hp ux - Limitation of HP awk -
a simple awk script works fine in linux , own hpux 11.31 platform, doesn't work in other hpux 11.31 system. can't access problematic hpux system not able test now.
@ input data
mystring my.linuxsrc running 16840 yourstring your.linuxsrc running 41794
@ myawk.awk
/mystring / { printf "%s#%s#%s#%s",$1,$2,first,$3; printf "\n"; flag="yes"}
@ error in other hpux system
syntax error source line 1 error context <<< >>> awk: quitting source line 1.
the version of awk in other hpux system:
other_hpux] /usr/bin/awk /usr/bin/awk: main.c $date: 2009/02/17 15:25:17 $revision: r11.31/1 patch_11.31 (phco_36132) run.c $date: 2009/02/17 15:25:20 $revision: r11.31/1 patch_11.31 (phco_36132) $revision: @(#) awk r11.31_bl2010_0503_1 patch_11.31 phco_40052
my hpux system:
my_hpux] /usr/bin/awk /usr/bin/awk: main.c $date: 2008/05/19 14:40:42 $revision: r11.23/3 patch_11.23 (phco_38267) lib.c $date: 2007/02/23 16:15:06 $revision: r11.23/2 patch_11.23 (phco_36053) run.c $date: 2008/05/19 14:40:53 $revision: r11.23/1 patch_11.23 (phco_38267) $revision: @(#) awk r11.23_bl2008_0602_1 patch_11.23 phco_38267
can let me know why simple awk fails in other hpux system?
@ resolution
the awk script includes crlf on unix box, there problem use file. after removing cr, works fine.
could please try following, though don't have hp os me, wanted in same.
awk '/mystring / { printf("%s#%s#%s#%s",$1,$2,first,$3); print ors}' input_file
or
awk '/mystring / { printf("%s#%s#%s#%s\n",$1,$2,first,$3)}' input_file
ed morton correct only, there unused variable removed in above code, let me how goes then.
Comments
Post a Comment