How to run an awk commands in Windows?
Asked Answered
L

7

32

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.

Liveryman answered 21/2, 2014 at 7:25 Comment(0)
A
21

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

Almonry answered 21/2, 2014 at 9:36 Comment(0)
D
14

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
Duplet answered 2/12, 2014 at 11:13 Comment(0)
G
6

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

Globular answered 21/2, 2014 at 7:38 Comment(0)
O
5

You can install awk: choco install awk

Then you can use: awk

Obel answered 15/12, 2021 at 20:12 Comment(0)
M
2

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.

Meuse answered 23/2, 2016 at 1:47 Comment(1)
i have installed awk and gwak on my pc. once you type awk after the installation, it should work. for the first time, im using path taht refers where awk.exe was stored. and execute some command.Meuse
D
1

Go to command windows (cmd) then type:

"c:\Progam Files(x86)\GnuWin32\bin\awk"
Delladelle answered 21/2, 2014 at 7:38 Comment(0)
E
1

https://scoop.sh/

With Scoop, you can install the awk for your windows terminal. Scoop automatically finds and installs the dependencies.

scoop install gawk

awk

awk2

homepage: https://sourceforge.net/projects/ezwinports/

Euphrates answered 1/9, 2022 at 8:36 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.