1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

TC12 Win7 console, running gawk scripts

Discussion in 'Support' started by jackw19, Mar 5, 2011.

  1. jackw19

    Joined:
    Feb 25, 2011
    Messages:
    6
    Likes Received:
    0
    I can't seem to run gawk or mawk scripts from the command line in a TC12 console window under Win7. I have defined gawk as an alias pointing to gawk.exe. To eliminate any problems w/ finding files or directories, I put my test script, test.awk, and the test data, xyz.txt, in the

    c:\Program Files (x86)\GnuWin32\bin

    directory, and ran my tests from this dir. My awk scritp looks like:

    { x++ }
    { print NF }

    END {
    print "x =", x > "CON"
    }

    The infile xyz.txt contains 21 lines of plain text, each of between 0 and 5 words. I gave the command line string:

    gawk -f test.awk xyz.txt > test.out

    And this produces the result:

    cannot open file `-f' for reading (No such file or directory)

    Same result using -F option. If I leave the option flag out altogether no error message is generated and test.out is created, but it's empty.

    I find the following strange.

    1) If I do the same thing (including either -f or -F option flag) from a Win7 cmd console window, the outfile test.out contains the expected 21 lines each giving the correct number of fields for the corresponding infile lines and x=21 is echoed to the screen.

    2) Same for mawk.

    3) If I leave out the option flag in the cmd environment, gawk objects to test.awk in the command, but runs if the .awk suffix is omitted. But then the outfile is empty and there's no report to the screen.

    4) Similar behavior with TC11 running XP Pro -- but Thompson Automation awk, tawk, runs fine with awk -f test.awk xyz.txt > test.out. Here awk is defined as an alias for the Thompson executable. Can't try this on Win7 because tawk is 16-bit.

    If there's a way to run gawk or mawk scripts from a TC12 console in Win7, I'd very much like to know what it is. Maybe someone knows the reason for the differences between the cmd and TC12 behavior described above?

    Thanks in advance.
     

Share This Page