[英]Pipe Java to Grep: Why not working?
I am trying to run this dreadfully simple command in Bash 我正在尝试在Bash中运行这个非常简单的命令
java -cp nasa-top-secret.jar gov.nasa.RocketToMoon | grep -v codehaus
but grep is not working (it does not filter out my string). 但是grep无法正常工作(它无法过滤掉我的字符串)。 How can I filter my java
output using grep
? 如何使用grep
过滤java
输出?
输出可能在STDERR上,请尝试以下操作:
java -cp nasa-top-secret.jar gov.nasa.RocketToMoon 2>&1 | grep -v codehaus
possible scenario 可能的情况
-v
stands for. 我假设您知道-v
代表什么。 possible troubleshooting step: 可能的故障排除步骤:
2>&1
at the end of the command and try again with grep 将2>&1
放在命令末尾,然后使用grep再试一次
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.