本文共 303 字,大约阅读时间需要 1 分钟。
查询带有空格等特殊字符的字符串时,如使用tail、cat、vim
等命令,可以对特殊符号使用反斜杠“\”
进行转义,或者使用英文单引号包裹查询字符串。但是对于vim
命令,不支持使用英文单引号。
' " * ? \ ~ ` ! # $ & | 空格
例如查找包含字符串push success ! deviceId
的内容
tail -f normal.log | grep push\ success\ \!\ deviceIdtail -f normal.log | grep 'push success ! deviceId:'
tail 示例截图
vim 示例截图,不能使用英文单引号
转载地址:http://wtcsn.baihongyu.com/