I am not sure if this is the right place for this question but since I am trying to write a batch file and gnu awk is giving me problems, I thought I'd ask it here.
My purpose is quite simple. I'd like to keep track of PIDs of windows processes in files. For instance I want to push the PIDs of putty.exe processes into a file called putty.pid, with the following command:
tasklist | find "putty.exe" | awk '{print $2}' > putty.pid
and this is what I am getting on my dos window
C:\MyUtil>tasklist | find "putty" | awk '{print $2}' > putty.pid
awk: '{print
awk: ^ invalid char ''' in expression
can anyone tell me what I am doing wrong here ? I freshly downloaded awk from http://gnuwin32.sourceforge.net/packages/gawk.htm
and extracted one single file awk.exe into my current directory. I might be missing a dll or something but its documentation is not very helpful.
在Windows中,您在命令行中传递给awk
的脚本必须用双引号引起来,与在传递给find
的字符串中使用的引号相同。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.