Log in

View Full Version : Manipulating SE IV data files


GoatFoot
February 21st, 2001, 10:08 AM
I don't know if I'm stating the obvious or demonstrating my ignorance, but I've found that sed on cygwin (http://www.cygwin.com) works quite well for modding the various data files in a consistent, controllable, and reproducible fashion.

There may be a bit of a learning curve, but there are plenty are resources on the web (http://www.landfield.com/faqs/editor-faq/sed/) if anyone should decide to investigate.

I'd stop reading here, if I were you.


As an example, no chosen quite at random http://www.shrapnelgames.com/ubb/images/icons/icon7.gif

assuming you've installed cygwin.

To change the Point-Defense research goal from 3 to 5 in all files:

create a text file re3-5.sed
--begin--
# Change Point-Defense research lvl from 3 to 5
/Tech Area Name.*Point-Defense/,/^$/{
/Tech Area Level/s/:= 3/:= 5/
}
--end--

then

back up all your files.

cd <SEIV Dir>/Pictures/Races

for file in `ls */*_AI_Research.txt`; do
sed -f ~/re3-5.sed $file > $file.tmp
mv $file.tmp $file
done

you have just changed every occurence of ":= 3" to ":= 5" that was on a line with "Tech Area Level" and that fell between lines "Tech Area Name... Point_Defense" and a blank line, in every file named <anything>_AI_Research.txt that was in a directory below <SEIV dir>/Pictures/Races.

you can put any number of changes in 1 file, and do them all at once.


I've been up way to long.

[This message has been edited by GoatFoot (edited 21 February 2001).]