linux中grep命令匹配制表符

1、测试数据

root@DESKTOP-1N42TVH:/home/test# ls
a.txt
root@DESKTOP-1N42TVH:/home/test# cat a.txt
d e u d
m       k j
a d c x
s k     f
root@DESKTOP-1N42TVH:/home/test# sed -n l a.txt
d e u d$
m\tk j$
a d c x$
s k\tf$
root@DESKTOP-1N42TVH:/home/test# grep "\t" a.txt   ## 直接匹配不能实现
root@DESKTOP-1N42TVH:/home/test# grep $'\t' a.txt   ## 配置制表符
m       k j
s k     f
root@DESKTOP-1N42TVH:/home/test# grep $'\t' a.txt | sed -n l  ##检查
m\tk j$
s k\tf$
root@DESKTOP-1N42TVH:/home/test# grep $'[\t]' a.txt  ## 支持正则
m       k j
s k     f

参考:https://www.jb51.net/article/143335.htm

原文地址:https://www.cnblogs.com/liujiaxin2018/p/15769394.html