linux中grep命令如何匹配制表符
1、测试数据
root@DESKTOP-1N42TVH:/home/test2# ls a.txt root@DESKTOP-1N42TVH:/home/test2# cat a.txt d ees j x e.s u z e s u w e s u root@DESKTOP-1N42TVH:/home/test2# sed -n l a.txt ## 显示出制表符 d ees j$ x e.s u$ z e s u$ w e\ts u$
2、如何匹配制表符
root@DESKTOP-1N42TVH:/home/test2# ls a.txt root@DESKTOP-1N42TVH:/home/test2# cat a.txt d ees j x e.s u z e s u w e s u root@DESKTOP-1N42TVH:/home/test2# sed -n l a.txt d ees j$ x e.s u$ z e s u$ w e\ts u$ root@DESKTOP-1N42TVH:/home/test2# grep '\t' a.txt root@DESKTOP-1N42TVH:/home/test2# grep $'\t' a.txt ## 在$符号,且使用单引号可以匹配制表符 w e s u root@DESKTOP-1N42TVH:/home/test2# grep $"\t" a.txt root@DESKTOP-1N42TVH:/home/test2# grep "\t" a.txt

浙公网安备 33010602011771号