zoukankan      html  css  js  c++  java
  • 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

  • 相关阅读:
    2015多校.Zero Escape (dp减枝 && 滚动数组)
    UVa-11809
    UVa-1588 Kickdown
    UVa-1587
    UVa-10340
    UVa-202
    UVa-1368
    UVa-232 Crossword Answers
    UVa-227
    UVa-455 Periodic Strings
  • 原文地址:https://www.cnblogs.com/liujiaxin2018/p/15769394.html
Copyright © 2011-2022 走看看