The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Shell Scripts kwliew999 AIX 7 06-12-2007 05:06 PM
Using #! /bin/sh in Shell scripts sumesh.abraham Shell Programming and Scripting 4 12-01-2006 03:29 AM
Help With Shell Scripts ragha81 Shell Programming and Scripting 6 08-18-2006 05:57 PM
Need Help With Shell scripts holler1 Shell Programming and Scripting 2 07-30-2006 11:43 PM
Difference between writing Unix Shell script and AIX Shell Scripts haroonec AIX 0 04-11-2006 11:27 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 11-09-2005
ccp ccp is offline
Registered User
 

Join Date: Nov 2005
Posts: 14
shell scripts help

Hi, I am not experienced in shell scripts, I hope someone can give some hint for the following problem

I have html file like this

<html>
<body>
Some stuff
More stuff
<pre>
A
B
</pre>
Still more stuff
And more
<pre>
C
D
</pre>
Additional stuff
</body>
</html>

I want to write the script to red this file and dump out
The items within the <pre> tags. For example, the output for the above file
shouild be

A
B
C
D

Thanks

Angela
Reply With Quote
Forum Sponsor
  #2  
Old 11-09-2005
vgersh99's Avatar
Moderator
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 3,029
Code:
nawk '/<pre>/,/<\/pre>/' ccp.txt | grep -v 'pre'
Reply With Quote
  #3  
Old 11-10-2005
Registered User
 

Join Date: Sep 2005
Location: Chennai
Posts: 80
Just to be safe:
nawk '/<[pP][rR][eE]>/,/<\/[pP][rR][eE]>/' ccp.txt|egrep -vi '<[/]?pre>'


Differences from previous:
(a) Since html is case insensitive wrt its tags, this accounts for case insensitive "PRE"
(b) while using grep -v, we might not want to use "pre" as the string, as this might accidentally leave out a lot of lines.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 05:46 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0