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

[ Attached Message ]

From:
To:
Date: Sat, 31 Oct 1998 12:35:56 -0500
Local: Sat, Oct 31 1998 12:35 pm
Subject: 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
: This is a multi-part message in MIME format.
                               ^^^^^^^^^^^^^^

   Please don't do that.

   Usenet runs on plain text. Your "newsreader" is misconfigured.

: 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!

   No problem.

: 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)

   With large volume and short deadline you kinda got a problem
   there. Even with the below, you are going to need to become
   a programmer in less that 72 hours.

   Good luck Jim.

: 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

[snip]

: </body>

: I need to make these changes to 800 documents

   use File::Find;

: and then write the edits
: back to the origional document.  

   see the -i switch in the 'perlrun' man page.

: Can anyone help?  Point me in the
: correct direction?

------------------------------------------------
#!/usr/bin/perl -w

undef $/;
$_ = <>;   # slurp. Not So Good for largish files...

$title = $1 if m#<title>(.*?)</title>#si;   # find the first title tag pair

$iso9000 =<<END9000;              # insert the title into the boilerplate
Name of the document: $title
Owner of document: Manager Department PT4
yada
yada
yada
END9000

s#</body>#$iso9000</body#;   # do the substitution

print;                       # output the slurped file
------------------------------------------------

Of course the above is a dirty hack that will not work correctly
in all cases. But how to do it robustly (use HTML::Parse) is
covered in several question in part 9 of the Perl FAQ...

: At least pity me?

   I pity all those who apply "encoding" to plain text.

--
    Tad McClellan                          SGML Consulting

    Fort Worth, Texas



Wed, 18 Apr 2001 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. in-place-edit regex substitution in multiple files

2. edit multiple files with vi

3. Multiple perlscripts editing same file

4. Edit multiple files

5. Regex Multiple occurances of a pattern in multiple lines

6. CGI.pm redirect multiple cookies or multiple domains

7. Regex problem: Multiple matches across Multiple lines

8. Does multiple scripts require multiple PERLs?

9. UNIX - Renaming files Multiple Files

10. Reading multiple files and saving to one file

11. UNIX - Renaming files Multiple Files

12. Efficent multiple scans of a file?

 

 
Powered by phpBB® Forum Software