My problem is similar to this one, but the part I want to extract lies inside the line and I also want to store it in a newly created column in the original file rather than output.
A line in my tab-delimited file looks like:
chr1 25228613 25229157 CDS HAVANA . - 2 ID=CDS:ENST00000338888.3;Parent=ENST00000338888.3;gene_id=ENSG00000020633.18_3;transcript_id=ENST00000338888.3_2;gene_type=protein_coding;gene_name=RUNX3;transcript_type=protein_coding;transcript_name=RUNX3-202;exon_number=7;exon_id=ENSE00001384103.2;level=2;protein_id=ENSP00000343477.3;transcript_support_level=1;tag=basic,appris_alternative_2,CCDS;ccdsid=CCDS30633.1;havana_gene=OTTHUMG00000003316.1_3;havana_transcript=OTTHUMT00000009285.1_2;remap_original_location=chr1:-:24902122-24902666;remap_status=full_contig
I want to extract content behind "gene_name" in $9, this line is RUNX3.
The expected output:
chr1 25228613 25229157 CDS HAVANA . - 2 ID=CDS:ENST00000338888.3;Parent=ENST00000338888.3;gene_id=ENSG00000020633.18_3;transcript_id=ENST00000338888.3_2;gene_type=protein_coding;gene_name=RUNX3;transcript_type=protein_coding;transcript_name=RUNX3-202;exon_number=7;exon_id=ENSE00001384103.2;level=2;protein_id=ENSP00000343477.3;transcript_support_level=1;tag=basic,appris_alternative_2,CCDS;ccdsid=CCDS30633.1;havana_gene=OTTHUMG00000003316.1_3;havana_transcript=OTTHUMT00000009285.1_2;remap_original_location=chr1:-:24902122-24902666;remap_status=full_contig RUNX3
How to do it using awk or sed?