How to run an awk commands in windows?

2019-01-07 17:23发布

I have downloaded gawk from here, but I can't seem to figure out how to use it. I am simply trying to run a command, not to write one.

标签: awk gawk
5条回答
放荡不羁爱自由
2楼-- · 2019-01-07 17:36

You can download and run the setup file. This should install your AWK in "C:\Program Files (x86)\GnuWin32". You can run the awk or gawk command from the bin folder or add the folder ``C:\Program Files (x86)\GnuWin32\binto yourPATH`.

enter image description here

查看更多
够拽才男人
3楼-- · 2019-01-07 17:51

Go to command windows (cmd) then type:

"c:\Progam Files(x86)\GnuWin32\bin\awk"
查看更多
Fickle 薄情
4楼-- · 2019-01-07 17:54

If you want to avoid including the full path to awk, you need to update your PATH variable to include the path to the directory where awk is located, then you can just type

awk

to run your programs.

Go to Control Panel->System->Advanced and set your PATH environment variable to include "C:\Program Files (x86)\GnuWin32\bin" at the end (separated by a semi-colon) from previous entry. enter image description here

查看更多
别忘想泡老子
5楼-- · 2019-01-07 17:56

Actually, I do like mark instruction but little differently. I've added C:\Program Files (x86)\GnuWin32\bin\ to the Path variable, and try to run it with type awk using cmd.

Hope it works.

查看更多
家丑人穷心不美
6楼-- · 2019-01-07 17:58

Quoting is an issue if you're running awk from the command line. You'll sometimes need to use \, e.g. to quote ", but most of the time you'll use ^:

w:\srv>dir | grep ".txt" | awk "{ printf(\"echo %s@%s ^> %s.tstamp^\n\", $1, $2, $4); }"
echo 2014-09-07@22:21 > requirements-dev.txt.tstamp
echo 2014-11-28@18:14 > syncspec.txt.tstamp
查看更多
登录 后发表回答