je fichiers comme suit:En utilisant gsub pour un nombre entre deux personnages
HNRNPF-human_SRA:SRR4421749_1_ENCFF938GRX.fastq.gz
RBFOX2-human_SRA:SRR4421654_1_ENCFF187PBG.fastq.gz
U2AF2-human_SRA:SRR3469570_1_ENCFF158ZML.fastq.gz
HNRNPK-human_SRA:SRR3469488_2_ENCFF267TVR.fastq.gz
RBFOX2-human_SRA:SRR4421654_1_ENCFF588WPC.fastq.gz
U2AF2-human_SRA:SRR3469570_1_ENCFF550GXB.fastq.gz
et je voudrais les réétiqueter à:
HNRNPF-human_SRA:SRR442174_ENCFF938GRX.fastq.gz
RBFOX2-human_SRA:SRR4421654_ENCFF187PBG.fastq.gz
U2AF2-human_SRA:SRR3469570_ENCFF158ZML.fastq.gz
HNRNPK-human_SRA:SRR3469488_ENCFF267TVR.fastq.gz
RBFOX2-human_SRA:SRR4421654_ENCFF588WPC.fastq.gz
U2AF2-human_SRA:SRR3469570_ENCFF550GXB.fastq.gz
-à-dire que je supprimer le numéro entre deux « _ » , je l'ai essayé différentes commandes comme gsub division, mais je ne pouvais en commande Split:
name=U2AF2-human_SRA:SRR3469570_1_ENCFF158ZML.fastq.gz
echo $name | awk '{split($0, arr, "[__]"); print arr[3]}'