linux 中如何输出包含指定字符串的单词

 

001、

[root@PC1 test]# ls
a.txt
[root@PC1 test]# cat a.txt                           ## 测试文件
243 fsab 989a 34b
sa  1113 ab34 df3
add gabe kkkk abk
[root@PC1 test]# sed 's/ /\n/g' a.txt | grep "ab"    ## 输出包含ab的单词
fsab
ab34
gabe
abk

 

posted @ 2022-09-29 22:00  小鲨鱼2018  阅读(63)  评论(0编辑  收藏  举报