TC12 Win7 console, running gawk scripts

Feb 25, 2011
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 }

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.
Similar threads
Thread starter Title Forum Replies Date
JohnQSmith Registering TC12.10 Support 5
S How to? Deinstalling TC/reinstating execution of bat files by cmd in Win7 Support 31
C Del /W999 2gbFile.ext / latest build / Win7 x64 / MSE / Everything Support 5
w_krieger Installer 20.0.21 on Win7 Support 19
C How to? Read Win7's Computer Libraries Support 19
D V19 fails to install on Win7-64bit, installer says: Support 2
vefatica Alt-Enter in Win7? Support 9
C SafeChars x64 plugin under Win7 x64 Support 2
C Win7 Program Data.... Support 2
C How to? work with Win7 Libraries Support 5
samintz Can't install 15.01.54 on Win7 x64 Support 6
S WAD Cannot access mapped drive in 64b Win7 Support 15
F How to install 64-bit after having installed 32-bit on Win7 Support 2
F No ide.exe or tcmd.exe files - Win7 64bit Support 5
vefatica Win7, FTP, TCC Support 1
vefatica A win7 trick Support 29
vefatica Had to reinstall Win7 ... Support 8
vefatica CLS /C slow on Win7 Support 7
vefatica SHORTCUT behavior (Win7) Support 3
vefatica OT:Explain Win7's "start menu" folder? Support 17
vefatica Win7 and sound Support 0
vefatica TCMD crash in Win7 Support 7
vefatica BEEP in Win7 Support 10
samintz Win7 Installer Q? Support 2
mscheuner TakeCommand no longer showing its icon in Win7 Taskbar Support 12
mscheuner Background color not "sticking" in TCMD v11 x64 on Win7 Support 3
mscheuner Configuration dialogs in TCMD 11 look horrible on Win7 Support 14
Fross Win7 x64 Dialog Size Issue Support 3
J BUG: MSGBOX after DETACH returns early with 0 on Win7 Support 3
vefatica Console not redrawn in BTM or with multiple commands Support 4
vefatica ShutdownPlugin not called when I X the console? (just curious) Support 4
vefatica Console popup windows don't work correctly Support 0
vefatica Cancelling selection in the console? Support 7
G Console exe up / down history Support 8
vefatica Console cursor height in Win 10 Support 3
vefatica BTM, elevated, console window caption? Support 4
vefatica TCEXIT not executed if I X the console Support 4
vefatica TYPE resets console tab settings Support 14
vefatica Undesired scrolling in Windows 10 enhanced console. Support 2
L WAD In console, tabs are rendered with non-uniform tab-stop spacing Support 16
P No linefeed on last line of console window Support 2 TCC v22 & the Windows 10 Console Support 5
C TCMD not hiding the console Support 1
jaltman tcmd 21.0.19 win10 16179 console window loses content Support 2
vefatica Console output slower that before Support 8
L Fixed console line length in Take Command 19? Support 3
P Color directories in Win10 build 10586 console Support 11
Mordachai How to capture all console output from a TCMD session? Support 4
I Windows 10 console does not allow alt-F4 alias to complete Support 1
M Console-Mode (*.exe) works in TCC, not in TCMD Support 2

Similar threads