0

A simple awk script works fine in Linux and my own HPUX 11.31 platform, but it doesn't work in other HPUX 11.31 system. I can't access the problematic HPUX system so I am not able to test something for 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 The source line is 1
The error context is
<<<       >>>
awk: Quitting
The source line is 1.

The version of awk in other HPUX system:

other_HPUX] what /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] what /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 you let me know why the simple awk fails in other HPUX system?

@ Resolution

The Awk script includes CRLF on Unix box, so there is a problem to use the file. After removing CR, it works fine.

Sigularity
  • 917
  • 2
  • 12
  • 28
  • 2
    The script you showed us will not produce an error unless your awk is severely broken which is extremely unlikely to be the issue. Assuming your awk is not broken, since `FIRST` is undefined and `flag` is never used I assume there's more to your script than you've shown us and so maybe that missing part of your script is where the error is. – Ed Morton Jul 25 '17 at 15:21
  • Thanks for your comment. Yes, there are other parts. Let me try to test the rest as well. – Sigularity Jul 25 '17 at 15:55
  • Reduce your script to a [mcve] and you probably will figure out the issue by yourself. – Ed Morton Jul 25 '17 at 16:36
  • 1
    Oh. My awk script is broken. It includes CRLF so I got this problem on hpux and AIX platform. Actually, the script is copied from Windows. I lost this basic thing. Thanks for you patience and comments. – Sigularity Jul 28 '17 at 08:47

0 Answers0