awk -F '[' '/^>/ { sub(/\..*/, "",$5); print $5 } !/^>/ { print }' GCF_000001405.39_GRCh38.p13_rna_from_genomic.fna
linux中提取包含指定字符的列
awk '{for(i=1;i<=NF;i++) if(index($i,"transcript_id")) print $i}' GCF_000001405.39_GRCh38.p13_rna_from_genomic.fna
linux中去掉每行=之前的字符串
sed 's/^[^=]*=//' process.fna > process_1.fna
去掉末尾的]
sed -i 's/[]]$//' process_1.fna
每一行加>
sed -i 's/^/>/' process_1.fna
以transcript_id为分隔符打印,再把=换成> (去掉点后了)
awk -F 'transcript_id' '/^>/ { sub(/\..*/, "",$2); print $2 } !/^>/ { print }' GCF_000001405.39_GRCh38.p13_rna_from_genomic.fna > process_4.fna
sed -i 's/=/>/g' process_4.fna
保留点
awk -F 'transcript_id' '/^>/ { sub(/\.*/, "",$2); print $2 } !/^>/ { print }' GCF_000001405.39_GRCh38.p13_rna_from_genomic.fna > process_5.fna
#去掉每行第一个]后所有内容
sed -i 's/].*//' process_5.fna