linux 中 正则表达式 匹配任意标点符号[[:punct:]]

 

001、

root@ubuntu01:/home/test# ls
a.txt
root@ubuntu01:/home/test# cat a.txt    ## 测试数据
2,7     3.23
72      3!8\34
34+3    444
root@ubuntu01:/home/test# awk '{print $1}' a.txt    ## 默认空格分隔符
2,7
72
34+3
root@ubuntu01:/home/test# cat a.txt
2,7     3.23
72      3!8\34
34+3    444
root@ubuntu01:/home/test# awk -F "[[:punct:]]" '{print $1}' a.txt    ## 指定任意标点符号作为分割符
2
72      3
34

 

posted @ 2023-02-17 23:16  小鲨鱼2018  阅读(300)  评论(0编辑  收藏  举报