You love working with the good old awk language for pattern scanning and text processing? Usually it’s sufficient to use awk fast and easy with one-line programs directly on command line. But sometimes it may be needful to write more extensive programs in script files e.g. for algorithm prototyping or more complex text processing applications. For recurring tasks it may be more comfortable to utilize executable awk scripts.
- Open cmd as admin
- Choose a file name extension for your executable awk scripts e.g. .awk
- Associate your file name extension with a file type denomination e.g. awkExec
- Link your file type with an awk interpreter. I use gawk.exe from a Git for Windows installation. You can download gawk for Windows separately from sourceforge. Make sure that the path below leads to your awk interpreter location
FTYPE awkExec=C:\Program Files\Git\usr\bin\gawk.exe -f %1 %*
The option -f is important to pass program files to gawk. %1 is replaced with the file name containing your awk code. %* is replaced with all of the parameters (e.g. an ascii file to be processed by the awk program). See technet.microsoft for more details concerning FTYPE.
- To reduce typing effort when using your AWK executable at command line, add .awk at PATHEXT under system environment variables. After that you can start your awk program by typing just the filename, without file name extension
Enjoy your executable awk scripts!