![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| 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 |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
Code:
nawk '/<pre>/,/<\/pre>/' ccp.txt | grep -v 'pre' |
|
#3
|
|||
|
|||
|
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. |
|||
| Google The UNIX and Linux Forums |