linux 中awk, split的应用

1、

[root@centos79 test]# cat a.txt
test3_1_clean.fq.gz test3_2_clean.fq.gz
test4_1_clean.fq.gz test4_2_clean.fq.gz
test5_1_clean.fq.gz test5_2_clean.fq.gz
[root@centos79 test]# awk '{OFS = "\t"}{split($1,x,"_"); print x[1], x[3], $1, $2}' a.txt
test3   clean.fq.gz     test3_1_clean.fq.gz     test3_2_clean.fq.gz
test4   clean.fq.gz     test4_1_clean.fq.gz     test4_2_clean.fq.gz
test5   clean.fq.gz     test5_1_clean.fq.gz     test5_2_clean.fq.gz

 

posted @ 2021-07-21 23:14  小鲨鱼2018  阅读(136)  评论(0编辑  收藏  举报