我有个命令例子,
device list给出了所有设备的状态为or或错误的下列格式
[okay ]: you are listening on : 11
[error ]: not currently listening: 22
[error ]: not currently listening: 33
[okay ]: you are listening on : 111我只想打印状态为okay的设备。
我尝试使用grep命令作为
device list | grep -r 'okay'
device list | grep -r '[okay ]'
device list | grep -r '^okay'
device list | grep 'okay'但它没有打印任何输出。如何打印状态正常的设备。
提前谢谢。
发布于 2014-03-24 11:05:43
删除grep命令的-r选项,它将工作:
device list | grep 'okay'-r用于递归搜索。
https://askubuntu.com/questions/438492
复制相似问题