Sponsored Content
Full Discussion: sed to extract HTML content
Top Forums UNIX for Advanced & Expert Users sed to extract HTML content Post 302298944 by aaaaargh on Wednesday 18th of March 2009 11:12:49 PM
Old 03-19-2009
IMO, its really a bad idea to parse HTML files using SED/AWK

Your best bet is to use PERL,

HTML::TreeBuilder - Parser that builds a HTML syntax tree - search.cpan.org
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

mail: html content

hi guys, am required to prepare a report and mail it, to make it more appealing :p i wish to have content of mail in rich text format i.e html type with mailx how to specify the content type of mail body as html? Thanks in advance!!! rishi (2 Replies)
Discussion started by: RishiPahuja
2 Replies

2. UNIX for Dummies Questions & Answers

How do I extract text only from html file without HTML tag

I have a html file called myfile. If I simply put "cat myfile.html" in UNIX, it shows all the html tags like <a href=r/26><img src="http://www>. But I want to extract only text part. Same problem happens in "type" command in MS-DOS. I know you can do it by opening it in Internet Explorer,... (4 Replies)
Discussion started by: los111
4 Replies

3. Shell Programming and Scripting

sed to extract only floating point numbers from HTML

Hi All, I'm trying to extract some floating point numbers from within some HTML code like this: <TR><TD class='awrc'>Parse CPU to Parse Elapsd %:</TD><TD ALIGN='right' class='awrc'> 64.50</TD><TD class='awrc'>% Non-Parse CPU:</TD><TD ALIGN='right' class='awrc'> ... (2 Replies)
Discussion started by: pondlife
2 Replies

4. Shell Programming and Scripting

Extract URLs from HTML code using sed

Hello, i try to extract urls from google-search-results, but i have problem with sed filtering of html-code. what i wont is just list of urls thay apears between ........<p><a href=" and next following " in html code. here is my code, i use wget and pipelines to filtering. wget works, but... (13 Replies)
Discussion started by: L0rd
13 Replies

5. Shell Programming and Scripting

SED to extract HTML text data, not quite right!

I am attempting to extract weather data from the following website, but for the Victoria area only: Text Forecasts - Environment Canada I use this: sed -n "/Greater Victoria./,/Fraser Valley./p" But that phrasing does not sometimes get it all and think perhaps the website has more... (2 Replies)
Discussion started by: lagagnon
2 Replies

6. Shell Programming and Scripting

help with sed needed to extract content from html tags

Hi I've searched for it for few hours now and i can't seem to find anything working like i want. I've got webpage, saved in file par with form like this: <html><body><form name='sendme' action='http://example.com/' method='POST'> <textarea name='1st'>abc123def678</textarea> <textarea... (9 Replies)
Discussion started by: seb001
9 Replies

7. Shell Programming and Scripting

Print content between two html tags

Hi Expert, Is there any other way to print and write to a same filename the content between two html tags? Here the sample: cat file.html <div id="outline"> hello world<br> </div> <div id="container_faq"> test1<br> </div> <div class="widget_quick"> thead test<br> </div> ... (3 Replies)
Discussion started by: lxdorney
3 Replies

8. Shell Programming and Scripting

Awk/sed HTML extract

I'm extracting text between table tags in HTML <th><a href="/wiki/Buick_LeSabre" title="Buick LeSabre">Buick LeSabre</a></th> using this: awk -F "</*th>" '/<\/*th>/ {print $2}' auto2 > auto3 then this (text between a href): sed -e 's/\(<*>\)//g' auto3 > auto4 How to shorten this into one... (8 Replies)
Discussion started by: p1ne
8 Replies

9. Shell Programming and Scripting

Mailx with attachment and html content

Hi, Please see my code below i'm trying get an email send with attachment and html content in the body. Using the code below will put the encoding for attachment in the body as well SUBJECT="$(echo "XPI Monitoring "${tcnt}" transactions waiting \nContent-Type: text/html")" cat... (3 Replies)
Discussion started by: bhoshan
3 Replies

10. Shell Programming and Scripting

Convert content of file to HTML

Hi I have file like this: jack black 104 daniel nick 75 lily harm 2 albert 5 and need to convert it into the html table like this: NO.......name....family..... id 1...........jack.....black.....104 2..........daniel....nick.......75 3..........albert.................5 i mean... (5 Replies)
Discussion started by: indeed_1
5 Replies
HTML::Tree(3)						User Contributed Perl Documentation					     HTML::Tree(3)

NAME
HTML::Tree - overview of HTML::TreeBuilder et al VERSION
3.23 SYNOPSIS
use HTML::TreeBuilder; my $tree = HTML::TreeBuilder->new(); $tree->parse_file($filename); # Then do something with the tree, using HTML::Element # methods -- for example: $tree->dump # Finally: $tree->delete; DESCRIPTION
HTML-Tree is a suite of Perl modules for making parse trees out of HTML source. It consists of mainly two modules, whose documentation you should refer to: HTML::TreeBuilder and HTML::Element. HTML::TreeBuilder is the module that builds the parse trees. (It uses HTML::Parser to do the work of breaking the HTML up into tokens.) The tree that TreeBuilder builds for you is made up of objects of the class HTML::Element. If you find that you do not properly understand the documentation for HTML::TreeBuilder and HTML::Element, it may be because you are unfamiliar with tree-shaped data structures, or with object-oriented modules in general. Sean Burke has written some articles for The Perl Journal ("www.tpj.com") that seek to provide that background. The full text of those articles is contained in this distribution, as: HTML::Tree::AboutObjects "User's View of Object-Oriented Modules" from TPJ17. HTML::Tree::AboutTrees "Trees" from TPJ18 HTML::Tree::Scanning "Scanning HTML" from TPJ19 Readers already familiar with object-oriented modules and tree-shaped data structures should read just the last article. Readers without that background should read the first, then the second, and then the third. SUPPORT
You can find documentation for this module with the perldoc command. perldoc HTML::Tree You can also look for information at: o AnnoCPAN: Annotated CPAN documentation http://annocpan.org/dist/HTML-Tree <http://annocpan.org/dist/HTML-Tree> o CPAN Ratings http://cpanratings.perl.org/d/HTML-Tree <http://cpanratings.perl.org/d/HTML-Tree> o RT: CPAN's request tracker http://rt.cpan.org/NoAuth/Bugs.html?Dist=HTML-Tree <http://rt.cpan.org/NoAuth/Bugs.html?Dist=HTML-Tree> o Search CPAN http://search.cpan.org/dist/HTML-Tree <http://search.cpan.org/dist/HTML-Tree> SEE ALSO
HTML::TreeBuilder, HTML::Element, HTML::Tagset, HTML::Parser, HTML::DOMbo The book Perl & LWP by Sean M. Burke published by O'Reilly and Associates, 2002. ISBN: 0-596-00178-9 It has several chapters to do with HTML processing in general, and HTML-Tree specifically. There's more info at: http://www.oreilly.com/catalog/perllwp/ http://www.amazon.com/exec/obidos/ASIN/0596001789 SOURCE REPOSITORY
HTML::Tree is maintained in Subversion hosted at perl.org. http://svn.perl.org/modules/HTML-Tree The latest development work is always at: http://svn.perl.org/modules/HTML-Tree/trunk Any patches sent should be diffed against this repository. ACKNOWLEDGEMENTS
Thanks to Gisle Aas, Sean Burke and Andy Lester for their original work. Thanks to Chicago Perl Mongers (http://chicago.pm.org) for their patches submitted to HTML::Tree as part of the Phalanx project (http://qa.perl.org/phalanx). Thanks to the following people for additional patches and documentation: Terrence Brannon, Gordon Lack, Chris Madsen and Ricardo Signes. AUTHOR
Original HTML-Tree author Gisle Aas. Handed off to Sean M. Burke. and Andy Lester. Currently maintained by Pete Krawczyk "<petek@cpan.org>". COPYRIGHT
Copyright 1995-1998 Gisle Aas; 1999-2004 Sean M. Burke; 2005 Andy Lester; 2006 Pete Krawczyk. (Except the articles contained in HTML::Tree::AboutObjects, HTML::Tree::AboutTrees, and HTML::Tree::Scanning, which are all copyright 2000 The Perl Journal.) Except for those three TPJ articles, the whole HTML-Tree distribution, of which this file is a part, is free software; you can redistribute it and/or modify it under the same terms as Perl itself. Those three TPJ articles may be distributed under the same terms as Perl itself. The programs in this library are distributed in the hope that they will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose. perl v5.12.1 2006-11-12 HTML::Tree(3)
All times are GMT -4. The time now is 08:57 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy