Re: Looking for a program to help with a tedious job

Subject: Re: Looking for a program to help with a tedious job
From: Sandy Harris <sandy -at- storm -dot- ca>
To: "TECHWR-L" <techwr-l -at- lists -dot- raycomm -dot- com>
Date: Mon, 05 Feb 2001 14:32:55 -0500

Marguerite Krupp wrote:

> OK, I've figured out how to rename all the source files with little pain.
> The biggie is changing the names in the Frame source files. I am thinking in
> terms of some kind of script that would open each file, search for the "old"
> imported file name, replace that with the "new" imported file name, save and
> close the file, go on to the next, etc., until it reached the end of the
> book. ..

> Can anyone suggest a tool, maybe shareware (?) that will do this?

This is the sort of task where Unix shines. Save the files in Frame's MIF format
and the rest is trivial with Unix text-manipulation tools. When I taught intro
to Unix years ago, this problem was a classroom exercise.

My suggestion would be to grab a set of free Unix-like tools for NT:

http://sources.redhat.com/cygwin/
http://agnes.dida.physik.uni-essen.de/~janjaap/mingw32/
AT&T's "Unix for Windows"; I don't have URL to hand

or just transfer the data to a Unix box. Presumably Cisco has a few :-)

Once you've done that, you could do the rest with sed(1), awk(1) or perl(1). The
(1)'s mean these are user commands documented in Section 1 of the manual. You read
the man pages with commands like "man 1 sed", or just "man sed".

I'd use sed(1). The program would look something like:

# loop through all MIF files
for i in *.mif
do
# read the current MIF file ($i)
# edit with sed, save results in temporary file
sed -f sedscript < $i > temp
# replace original with edited version
mv temp $i
done

and sedscript would be a large file alomg the lines of:

s/old name 1/New Name 1.0/
s/xyzzy/Some other string/

These commands are just s for substitute, replacing every occurrence of
"old name 1" with "New Name 1.0", and so on.

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Develop HTML-Based Help with Macromedia Dreamweaver 4 ($100 STC Discount)
**WEST COAST LOCATIONS** San Jose (Mar 1-2), San Francisco (Apr 16-17)
http://www.weisner.com/training/dreamweaver_help.htm or 800-646-9989.

Sponsored by DigiPub Solutions Corp, producers of PDF 2001
Conference East, June 4-5, Baltimore/Washington D.C. area.
http://www.pdfconference.com or toll-free 877/278-2131.

---
You are currently subscribed to techwr-l as: archive -at- raycomm -dot- com
To unsubscribe send a blank email to leave-techwr-l-obscured -at- lists -dot- raycomm -dot- com
Send administrative questions to ejray -at- raycomm -dot- com -dot- Visit
http://www.raycomm.com/techwhirl/ for more resources and info.


Previous by Author: RE: Miffed by BMP
Next by Author: C&C convention (was Re: My ad for the XMFL)
Previous by Thread: Looking for a program to help with a tedious job
Next by Thread: RE: Looking for a program to help with a tedious job


What this post helpful? Share it with friends and colleagues:

Sponsored Ads


Sponsored Ads