i've tried to print only <table>...</table> part out of an html-
document.
Example:
<html>
<body>
...
...
...
<table>
<tr>
<td>test1</td>
</tr>
</table>
...
...
<table>
<tr>
<td>test2</td>
</tr>
</table>
...
...
...
</body>
</html>
Now I've tried to print the first occurrence of <table>...</table>:
<table>
<tr>
<td>test1</td>
</tr>
</table>
Can anyone help me? I'm a Beginner in AWK.
Kind regards
Andreas
If the delimiters are really on their own lines:
awk '/<table>/{f=1} f /<[/]table>/{exit}' file
Ed.
missed the semicolon:
thank you for your experience.
By the way...I'm searching for an Book about AWK / sed. Can you tell
me a favourite one?
Kind regards
Andreas
Don't get a book on sed. Sed is an excellent tool for simple substitutions on a
single line. For anything else you should use awk or perl or similar so anything
you think you might need a book on sed for, you shouldn't be using sed for so
you don't need a book on it.
For awk get Effective Awk Programming, Third Edition By Arnold Robbins
http://www.oreilly.com/catalog/awkprog3/.
Ed.
There are many resources online also for learning awk, here is one.
http://www.gnu.org/software/gawk/manual/gawk.html#dir You can dl the
file: http://www.gnu.org/software/gawk/manual/
Barrie
Yeah, but then the author won't make any money off the enormous amount of work
he put into it and maybe he won't bother to keep maintaining the online version,
or the tool itself, or writing the next version of the book, etc. so it'd be
nice if people actually bought the book:
Effective Awk Programming, Third Edition By Arnold Robbins
http://www.oreilly.com/catalog/awkprog3/
and just used the on-line version as a reference when convenient.
Ed.