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.
我在单行中运行多个命令,需要搜索模式 ex:
cd udaya/;service status;service2 status
在我想通过 grep 在同一行中搜索某些模式之后,仅针对这两个服务而不是
cd udaya/;service status | grep -i 'text';service2 status | grep -i 'text'
为什么因为我想从这两个服务中搜索相同的模式。
所以,我只能看到这些服务的模式输出。
非常感谢您的帮助。
使用子shell怎么样?
( service status & service2 status ) | grep -i 'text'
或者,您可以使用命名管道。