001、
[root@PC1 test3]# ls a.txt [root@PC1 test3]# cat a.txt ## 测试数据 334 gene kkk yyy gene gene kkk gene gene mmmm [root@PC1 test3]# awk 'BEGIN{a="no"}{if($0 == "gene" && a == "yes") { print NR}; if($0 == "gene") {a="yes"}else {a="no"}}' a.txt ## 输出gene连续重复的行号 6 9
标签:字符,test3,gene,输出,##,PC1,linux,txt,root From: https://www.cnblogs.com/liujiaxin2018/p/17457539.html