RE: Programming / scripting languages in tech-writing

Subject: RE: Programming / scripting languages in tech-writing
From: Megan Golding <mgolding -at- secureworks -dot- com>
To: "TECHWR-L" <techwr-l -at- lists -dot- raycomm -dot- com>
Date: 06 May 2002 14:36:56 -0400


On Mon, 2002-05-06 at 14:19, KMcLauchlan -at- chrysalis-its -dot- com wrote:
> So, how trivial is it, in PERL, to search out and manipulate
> text in multiple (say) FM files that has certain attributes applied?
> For example, I might be looking for all occurrences of CA3,
> where the three is superscripted.

Assuming the files you're working with are flat text (not some binary
thing like Word uses)...using Perl to search out and replace strings is
trivial. Your scripts will look something like this:

* find the files you want to manipulate (I usually use a filter, looking
for all files with a certain extension in the working directory)
* write a loop to open each file,
* find the offending text,
* replace it, and
* close the file
* loop thru again

To do the actual text-replacing, Perl uses regular expressions to
specify the string you're looking for, say:

s/CA^3/CA3/g

will search for the string "CA^3" and substitute it with "CA3" globally.

My first Perl script? About a year ago, I wrote a script to go through
an HTML file and split it out into separate HTML files with a file name
based on the contents of an <H1> tag. The entire script is less than 40
lines long and most of those are comments :)

I think the key to deciding when to use Perl for search and replace
tasks is when multiple files are involved. Its way easier to use the
script than to open every file and replace the text.

Along those lines, you should check out _Perl for Web Site Management_
from O'Reilly books (http://www.oreilly.com/catalog/perlwsmng/). The
author's examples apply to web site work as well as tech writing.

Meg
--

Megan Golding (mgolding -at- secureworks -dot- net)
SecureWorks, Inc.

Make your life a mission - not an intermission.
-- Arnold Glasgow



^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Buy RoboHelp Office in May and you'll save $100 with our mail-in rebate.
Or switch from Doc-to-Help or ForeHelp to RoboHelp Office for only $499.
Get the help authoring tool PC magazine recently awarded a perfect score!
Go to http://www.ehelp.com/techwr

Free copy of ARTS PDF Tools when you register for the PDF
Conference by April 30. Leading-Edge Practices for Enterprise
& Government, June 3-5, Bethesda,MD. www.PDFConference.com

---
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: Programming / scripting languages in tech-writing
Next by Author: Re: FrameMaker files to UNIX man
Previous by Thread: RE: Programming / scripting languages in tech-writing
Next by Thread: RE: Programming / scripting languages in tech-writing


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


Sponsored Ads