automating a change in a header file

excalibur3

Member
Oct 14, 2005
149
0
0
I have a bunch of instrumentation files (.par files) that I would like to load into another program. Unfortunately before this is possible they must first be opened in wordpad and a specific phrase in the header file must be changed (SPIP -> STM). Doing it manually is very easy because I just load it up and change it right in word pad. Is there a way to automate this process? It always occurs in the same location on the 4th line of the file. There are like 5,000 files though so doing it by hand would be laborious to say the least.
Thanks!
Stephen
 

NogginBoink

Diamond Member
Feb 17, 2002
5,322
0
0
I'd recommend a crash course in learning VBScript.

Start with the scripting.filesystemobject. If you've done any programming before, it shouldn't be too hard.
 

nweaver

Diamond Member
Jan 21, 2001
6,813
1
0
I wouldn't use vbscript. Perl is THE language for text manipulation. The only easier course would be bash with sed and awk :)

With perl (assuming they are all in one directory) I would read the directory listing into an array, then use that to loop through the array to open every file. Find the line with spip and change that line to stm. SHouldn't be too complex of a script tbh.