linux下grep查找带有空格的字符串

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_30038111/article/details/83447045

例如查找包含字符串push success ! deviceId的内容

# 使用‘\’转义空格,如果查找的字符串包含特殊字符,需要使用‘\’转义
tail -f normal.log | grep push\ success\ \!\ deviceId
cat normal.log | grep push\ success\ \!\ deviceId
tail -f normal.log | grep \"dataType\":11
# 使用''单引号包裹查询字符串
tail -f normal.log | grep 'push success ! deviceId:'
cat normal.log | grep 'push success ! deviceId:'
tail -f normal.log | grep '"dataType":11'

猜你喜欢

转载自blog.csdn.net/qq_30038111/article/details/83447045
今日推荐