Unix users: awk question

Subject: Unix users: awk question
From: "Michael Collier" <mcollier -at- arlut -dot- utexas -dot- edu>
To: "TECHWR-L" <techwr-l -at- lists -dot- raycomm -dot- com>
Date: Mon, 24 Sep 2001 08:51:54 -0500

Please e-mail responses directly to me - I'll make solutions available to
interested subscribers.

For all of the html files in a directory, I need to get the contents of the
<title> tag copied into an <h1> tag. Right now I'm looking at using awk to
try to do this. Empty <h1> tags exist in the html files.

I have the following right now:

ls /htmldir/*.html > /tmp/html.list
for file in `cat /tmp/html.list`
do
awk '/<\/title>/ { IFS="</?title>"; field = $2; IFS=" " }
/<h1> *<\/h1>/ { print $1 field $2 }
{print}' $file
done

However this script only creates an empty <h1> tag and moves everything into
one file.

I'm not tied to using awk, I can use perl or other scripting tool if there
is a better way. Thanks for any suggestions - please e-mail me directly as
this is probably not of wide-ranging techwr-l interest.

The technical writing problem this is intended to solve: a spec author has a
bunch of tables published at html, which are titled but the title does not
appear in the body of the html file.

Thanks,

................................................................
Michael Collier, Technical Writer Office: N636
Information Systems Laboratory http://isl.arlut.utexas.edu/
Applied Research Laboratories: The University of Texas at Austin
Voice: 512-835-3408 mailto:mcollier -at- arlut -dot- utexas -dot- edu
................................................................


^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

A landmark hotel, one of America's most beautiful cities, and
three and a half days of immersion in the state of the art:
IPCC 01, Oct. 24-27 in Santa Fe. http://ieeepcs.org/2001/

+++ Miramo -- Database/XML publishing automation. See us at +++
+++ Seybold SFO, Sept. 25-27, in the Adobe Partners Pavilion +++
+++ More info: http://www.axialinfo.com http://www.miramo.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: leaving
Next by Author: RE: FrontPage --> HTML converter wanted
Previous by Thread: RE: Dallas-Fort Worth Area
Next by Thread: Online documentation saves trees? Not!


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


Sponsored Ads