Hello,
I have about 30 VCF files with file names as ID_001.new.vcf. I want to extract only the "ID_001" part from the file name and change it in the header line of the VCF file where "Sample1" is given.
#CHROM POS ID REF ALT QUAL FILTER INFO FORMAT Sample1
So that the result looks like that:
#CHROM POS ID REF ALT QUAL FILTER INFO FORMAT ID_001
How can I do it ? I tried to use echo in bash and extract the IDs from the Filename but I am unable to iterate it to change inside the file. Thanks for your help.
Take a back up of original file before proceeding.