To replace all precursor masses in the MS3 MGF file with the precursor masses of their parent ions, execute the script from the command line with both the MS2 and MS3 MGF files. The MGF files must have the scan number in their TITLE= line, like this: TITLE= Scan:1417 It does not matter what else is on the title line as long as Scan:1234 is there. Depending on the program that created it, your file might look differently. In that case, you'd have to change the script in two locations indicated in the script. You might have to make the script executable first: $ chmod +x MS3toMS2mimic.pl Usage: $ ./MakeMimic.pl >