Multiple edits, multiple files 
Author Message
 Multiple edits, multiple files

I have a bit of an issue...  first, to invoke some sympathy, some
background.
I recently inherited a web site from a departed co-worker.  I am now
responsible for over 800 pages of content.  Make that 800 pages of
content lacking ISO-9000 document control pages.  I have 3 days to add
this information to these pages or else!

So here's what I have...
I need a script (awk, sed, perl or shell) to do the following, and I am
having alot of difficulty (a newbie to scripting here)

In psuedo code:

take the value located between the <title> and </title> and hold it.
Search for </body> and replace it with:

Name of the document: RECALL STORED VALUE HERE
Owner of document: Manager Department PT4
Required approvals: Manager Department PT4
This document was last updated on: Oct. 31 1998
This document is located on: url stuff here
Distribution list: Department PT4
Document control:

Records retention period for this document is for one year or until it
is no longer required. (Example: replacement procedure or an
organizational change render this document no longer a necessity in
meeting business needs)
Users of this document can recommend changes by contacting the owner.
The owner of this document is the only individual authorized to make
changes to this document.
The owner will ensure all users of this document are made aware of any
changes, additions, or deletions. This includes complete deletion of a
document.

Revision Change History for RECALL STORED VALUE AGAIN
Revision dates:
Original issue date: June 15, 1998
Approved by: Manager Department PT4
Change history:
Revision 1 changes:

</body>

I need to make these changes to 800 documents and then write the edits
back to the origional document.  Can anyone help?  Point me in the
correct direction?
At least pity me?

Drew



Wed, 18 Apr 2001 03:00:00 GMT  
 Multiple edits, multiple files
So in unix it might be something like:

find . -type f -name "*.html" -exec "gawk -f htmlhelp.awk {};"

or something like that (I don't have a sh handbook handy and I don't use
it often enough to remember the syntax). Also, you might want to
redirect your print and printf commands to a file within the awk script
rather than just sending them STDOUT. Inside the script just use the
built in FILENAME variable following a redirect symbol and be sure to
append ".new" to the file name or else things will get screwed up.
Example:

printf "%s" titleContent >FILENAME ".new"

will create a modified version of the currently processed file with an
extension .new

Cesar
--
Please remove the uppercase characters from my e-mail address for the
real thing



Wed, 18 Apr 2001 03:00:00 GMT  
 Multiple edits, multiple files
pu them at the end of the format string in each of the printf string
just before the \n

i.e.

printf "%s<br>\n", "Owner of document: Manager Department PT4"

because the carriage returns will not be interpreted correctly by a
browser as end of lines (but I'm betting you know that already)

Cesar
--
Please remove the uppercase characters from my e-mail address for the
real thing



Wed, 18 Apr 2001 03:00:00 GMT  
 Multiple edits, multiple files
Hey Drew,

First off, I do feel really bad for you.  If I were entrusted with such a
task I think that the powerful combination of perl with a shell wrapper
might do the trick.  As you may or may not know perl is the best for
parsing.  You can use a shell to find all the *.html files and then parse
them on the tags taking the information in between and putting them into a
hash.  If you don't have it, I would highly recommend buying Programming
Perl 2nd Edition by O'Reilly.  The stuff about relative expressions should
really help.  It is still going to a bit of coding, but you should be able
to release a 1.0 version in three days.

Good luck and don't get to stressed,
Mike


Quote:
> I have a bit of an issue...  first, to invoke some sympathy, some
> background.
> I recently inherited a web site from a departed co-worker.  I am now
> responsible for over 800 pages of content.  Make that 800 pages of
> content lacking ISO-9000 document control pages.  I have 3 days to add
> this information to these pages or else!

> So here's what I have...
> I need a script (awk, sed, perl or shell) to do the following, and I am
> having alot of difficulty (a newbie to scripting here)

> In psuedo code:

> take the value located between the <title> and </title> and hold it.
> Search for </body> and replace it with:

> Name of the document: RECALL STORED VALUE HERE
> Owner of document: Manager Department PT4
> Required approvals: Manager Department PT4
> This document was last updated on: Oct. 31 1998
> This document is located on: url stuff here
> Distribution list: Department PT4
> Document control:

> Records retention period for this document is for one year or until it
> is no longer required. (Example: replacement procedure or an
> organizational change render this document no longer a necessity in
> meeting business needs)
> Users of this document can recommend changes by contacting the owner.
> The owner of this document is the only individual authorized to make
> changes to this document.
> The owner will ensure all users of this document are made aware of any
> changes, additions, or deletions. This includes complete deletion of a
> document.

> Revision Change History for RECALL STORED VALUE AGAIN
> Revision dates:
> Original issue date: June 15, 1998
> Approved by: Manager Department PT4
> Change history:
> Revision 1 changes:

> </body>

> I need to make these changes to 800 documents and then write the edits
> back to the origional document.  Can anyone help?  Point me in the
> correct direction?
> At least pity me?

> Drew



Sat, 21 Apr 2001 03:00:00 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. Multiple textures on one IndexFaceSet [multiple files, not a map]

2. TCLLib cmdline - multiple file names and multiple invocations

3. Edit-In-Place on sheet with multiple browses

4. question on multiple record edit from TBrowse

5. Multiple CPUs and multiple PCs

6. Multiple DAQ boards/multiple VIs?

7. Multiple Dispatch (was Re: Replacing Multiple Inheritance with Java's Interfaces)

8. Multiple Windows on Multiple Machines

9. Updating multiple fields on multiple rows

10. Multiple fileevents for multiple process pipelines?

11. Multiple INCLUDE Vs multiple USE

12. Multiple lsearch and multiple list delete

 

 
Powered by phpBB® Forum Software