I have a large suite of fixlets, tasks and analyses which need to have their description fields altered.
At first glance, it looks like an export of them dumps them into XML (or XML-like stuff). I started playing with perl’s XML::Simple, and I can read in the data wonderfully.
Exporting it out is another thing entirely. As long as I don’t want it in XML format, it looks very pretty. Turning it into XML results in a file that I can’t reimport.
I can’t be the first person who needs to change a quick twelve dozen fixlets,tasks and analyses, without altering anything but the description field. What solutions have others implemented? While I can manually alter all of these, It won’t have the consistency that automation can guarantee.
If you’re comfortable with Perl, I wouldn’t worry about the whole XML format issue. Just export the data as one chunk, parse the data file line by line and do a regex match on “”. Once you know which lines you need to alter, figure out what replacements you want to do, make those changes and just spit all the output back into your new .bes file. Shouldn’t take too long to do.
I would treat any lines with !CDATA as exceptions and just do those seperately. That is, filter them out during your first pass(es) and then later only edit the lines containing !CDATA.
The code below (added to assist others who might not know it as well as you) should do exactly that (modify the descriptions, except for the ones with CDATA), which you can easily remove if you don’t need to worry about them being different. This changes any instances of the year 2010 to 2011. This is only a test version, as it just prints the description line (all of them, modified or not) so that you can see whats changed and be sure you’re happy with what is being created.