perl -i.bak -pe 's/^>Sample_([0-9]+)_x([0-9]+)$/ID$1 $2/' filename [download]
In reply to Re: modifying a file with regex! by JavaFan in thread modifying a file with regex! by rna_follower