Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
此刻我得到:
tasklist | grep java
它提供以下行:
java.exe 1234 Console 1 100.0k
现在我只需要第二个参数,在本例中为 1234。
tasklist | grep java | ???
tasklist | awk '/java/{ print $2 }'
用于awk打印与您的 grep 模式匹配的行的第二个单词
awk
tasklist | grep java | awk '{print $2}'