Menu

#1362 gawk.exe not properly undestand awk syntax

component_package
closed-invalid
nobody
MSYS (75)
2010-01-26
2009-10-22
No

MSYS version 1.0.10, 1.0.11

test to reproduce:
1. exec in cmd.exe: echo MS07-028 |gawk ' /^MS.*/ { print "http://www.microsoft.com/technet/security/bulletin/" $1 ".mspx" } /^[^M].*/ { print "http://support.microsoft.com/kb/" $1 }'
or (change [^M] to [0-9]) exec: echo MS07-028 |gawk ' /^MS.*/ { print "http://www.microsoft.com/technet/security/bulletin/" $1 ".mspx" } /^[0-9].*/ { print "http://support.microsoft.com/kb/" $1 }'
2. result:
http://www.microsoft.com/technet/security/bulletin/MS07-028.mspx
http://support.microsoft.com/kb/MS07-028
3. But must print only first line.

But:
1. exec: echo 3MS07-028 |gawk ' /^MS.*/ { print "http://www.microsoft.com/technet/security/bulletin/" $1 ".mspx" } /^[^M].*/ { print "http://support.microsoft.com/kb/" $1 }'
2. result:
http://support.microsoft.com/kb/3MS07-028
3. This is fine. Work properly.

Discussion

  • Keith Marshall

    Keith Marshall - 2010-01-26
    • status: open --> closed-invalid
     
  • Keith Marshall

    Keith Marshall - 2010-01-26

    Your test to reproduce this requires running an MSYS binary (gawk.exe) from the cmd.exe shell. Such binaries are intended to be invoked from MSYS' own bash shell ONLY; use from cmd.exe is unsupported.