The following file is tab-separated. I tried to remove from the first column NbLab330C00 64506568 the number after space in order to get NbLab330C00.
$ head LAB330_TE_annotation.gff3
##gff-version 3
##date Sun Feb 14 08:41:36 UTC 2021
##Identity: Sequence identity (0-1) between the library sequence and the target region.
##ltr_identity: Sequence identity (0-1) between the left and right LTR regions.
##tsd: target site duplication.
##seqid source sequence_ontology start end score strand phase attributes
NbLab330C00 64506568 EDTA Gypsy_LTR_retrotransposon 2 3364 20798 - . ID=TE_homo_0;Name=TE_00007365_INT;Classification=LTR/Gypsy;Sequence_ontology=SO:0002265;Identity=0.868;Method=homology
NbLab330C00 64506568 EDTA Gypsy_LTR_retrotransposon 3367 4198 3385 - . ID=TE_homo_1;Name=TE_00008087_LTR;Classification=LTR/Gypsy;Sequence_ontology=SO:0002265;Identity=0.865;Method=homology
NbLab330C00 64506568 EDTA hAT_TIR_transposon 4424 4715 1278 + . ID=TE_homo_2;Name=TE_00003964;Classification=DNA/DTA;Sequence_ontology=SO:0002279;Identity=0.834;Method=homology
NbLab330C00 64506568 EDTA hAT_TIR_transposon 5236 5453 835 + . ID=TE_homo_3;Name=TE_00001425;Classification=DNA/DTA;Sequence_ontology=SO:0002279;Identity=0.828;Method=homology
I tried the following awk command but it shorten also the last column.
$ awk -v OFS='\t' '{print $1,$3,$4,$5,$7,$8,$9}' LAB330_TE_annotation.gff3 > LAB330_TE_annotation.fix.gff3
(base) ubuntu@ip-10-23-2-113:/efs/apollo/LAB330$ head LAB330_TE_annotation.fix.gff3
##gff-version
##date Feb 14 08:41:36 2021
##Identity: identity (0-1) between library sequence and
##ltr_identity: identity (0-1) between left and right
##tsd: site duplication.
##seqid sequence_ontology start end strand phase attributes
NbLab330C00 EDTA Gypsy_LTR_retrotransposon 2 20798 - .
NbLab330C00 EDTA Gypsy_LTR_retrotransposon 3367 3385 - .
NbLab330C00 EDTA hAT_TIR_transposon 4424 1278 + .
NbLab330C00 EDTA hAT_TIR_transposon 5236 835 + .
(base) ubuntu@ip-10-23-2-113:/efs/apollo/LAB330$
How to fix the above command,
Thank you in advance,
awksees ten columns, you only print up to column 9. Add$10and you will be fine. You may want to exclude comment lines; right now, their second column is also removed from the output.