TechWhirl (TECHWR-L) is a resource for technical writing and technical communications professionals of all experience levels and in all industries to share their experiences and acquire information.
For two decades, technical communicators have turned to TechWhirl to ask and answer questions about the always-changing world of technical communications, such as tools, skills, career paths, methodologies, and emerging industries. The TechWhirl Archives and magazine, created for, by and about technical writers, offer a wealth of knowledge to everyone with an interest in any aspect of technical communications.
Re: Looking for a program to help with a tedious job
Subject:Re: Looking for a program to help with a tedious job From:Holger Wahlen <H -dot- Wahlen -at- gmx -dot- de> To:"TECHWR-L" <techwr-l -at- lists -dot- raycomm -dot- com> Date:Mon, 5 Feb 2001 23:27:06 +0000
Sandy Harris wrote:
> 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
Perl might be a bit handier here because you can just use a command
line option instead of dealing with temporary files manually, and you
can also save the loop this way and do everything with just one line:
perl -pi script *.mif
(Does Windows' DOS shell allow such a loop at all? Or do you have to
use a Unix-like shell for that as well? In the latter case using perl
also saves you from installing a second program.)
> 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.
Every first occurrence in a line, that is; to replace all occurrences,
add "g" at the end (and a semicolon if you use perl instead of sed) of
the script line.
/HW
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
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.