Sponsored Content
Full Discussion: Extract the tables from html
Top Forums UNIX for Beginners Questions & Answers Extract the tables from html Post 303032235 by RudiC on Thursday 14th of March 2019 04:41:21 AM
Old 03-14-2019
Quote:
Originally Posted by deepti01
i am just learning to do it . ...
Doesn't really answer Neo's question. Please explicitly tell us HOW and WHERE you learn to do it. What is your motivation to do so?



I see you incorporated but commented out my recent proposal to extract the second table from the HTML file. What keeps you from adapting it to your needs?

And, why don't you go for doing all of your task in one single script, e.g. awk?

RavinderSingh13 asked you to post "samples of input and expected output". If done, you could get hints on how to do it optimally.
 

10 More Discussions You Might Find Interesting

1. 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

2. UNIX for Dummies Questions & Answers

extract data from html tables

hi i need to use unix to extract data from several rows of a table coded in html. I know that rows within a table have the tags <tr> </tr> and so i thought that my first step should be to to delete all of the other html code which is not contained within these tags. i could then use this method... (8 Replies)
Discussion started by: Streetrcr
8 Replies

3. UNIX for Advanced & Expert Users

sed to extract HTML content

Hiya, I am trying to extract a news article from a web page. The sed I have written brings back a lot of Javascript code and sometimes advertisments too. Can anyone please help with this one ??? I need to fix this sed so it picks up the article ONLY (don't worry about the title or date .. i got... (2 Replies)
Discussion started by: stargazerr
2 Replies

4. AIX

Extract data from DB2 tables and FTP it to outside company's firewall

Please help me in creating the script in AIX. requirement is; The new component's main function is to extract the data from DB2 tables and company's firewall directly. The component function needs to check the timestamp in the DB2 tables ((CREDAT and CRETIM) with the requested timestamp and... (1 Reply)
Discussion started by: priyanka3006
1 Replies

5. Shell Programming and Scripting

How to extract url from html page?

for example, I have an html file, contain <a href="http://awebsite" id="awebsite" class="first">website</a>and sometime a line contains more then one link, for example <a href="http://awebsite" id="awebsite" class="first">website</a><a href="http://bwebsite" id="bwebsite"... (36 Replies)
Discussion started by: 14th
36 Replies

6. Shell Programming and Scripting

awk to create two HTML Tables

I am working on awk script to generate an HTML format output. With input file as below I am able to generate a HTML file however I want to saperate spare devices in a different table than rest of the devices and which has only Bunch ID, RAW Size and "Bunch Spare" status columns. INPUT File : ... (2 Replies)
Discussion started by: dynamax
2 Replies

7. UNIX for Dummies Questions & Answers

Extract table from an HTML file

I want to extract a table from an HTML file. the table starts with <table class="tableinfo" and ends with next closing table tag </table> how can I do this with awk/sed... ---------- Post updated at 04:34 PM ---------- Previous update was at 04:28 PM ---------- also I want to... (4 Replies)
Discussion started by: koutroul
4 Replies

8. Shell Programming and Scripting

Splitting csv into 3 tables in html file

I have the data in csv in 3 tables. how can I output the same into 3 tables in html.also how can I set the width. tried multiple options . attached is the format. #!/bin/ksh awk 'BEGIN{ FS="," print "<HTML><BODY><TABLE border = '1' cellpadding=10 width=100>" print... (7 Replies)
Discussion started by: archana25
7 Replies

9. HP-UX

Unable to send attachment with html tables in UNIX shell script

Heyy, any help would be grateful.... LOOKING FOR THE WAYS TO SEND AN EMAIL WITH ATTACHMENT & HTML TABLES IN BODY THROUGH SHELL SCRIPT (LINUX)..NOT SURE, IF WE HAVE ANY INBUILT HTML TAG OR UNIX COMMAND TO SEND THE ATTACHMENTS. KINDLY HELP below is small script posted for our understanding..... (2 Replies)
Discussion started by: Harsha Vardhan
2 Replies

10. UNIX for Beginners Questions & Answers

awk to extract value after keyword in html

Using awk to extract value after a keyword in an html, and store in ts. The awk does execute but ts is empty. I use the tag as a delimiter and the keyword as a pattern, but there probably is a better way. Thank you :). file <html><head><title>xxxxxx xxxxx</title><style type="text/css"> ... (4 Replies)
Discussion started by: cmccabe
4 Replies
Tagset(3)						User Contributed Perl Documentation						 Tagset(3)

NAME
HTML::Tagset - data tables useful in parsing HTML VERSION
Version 3.20 SYNOPSIS
use HTML::Tagset; # Then use any of the items in the HTML::Tagset package # as need arises DESCRIPTION
This module contains several data tables useful in various kinds of HTML parsing operations. Note that all tag names used are lowercase. In the following documentation, a "hashset" is a hash being used as a set -- the hash conveys that its keys are there, and the actual values associated with the keys are not significant. (But what values are there, are always true.) VARIABLES
Note that none of these variables are exported. hashset %HTML::Tagset::emptyElement This hashset has as values the tag-names (GIs) of elements that cannot have content. (For example, "base", "br", "hr".) So $HTML::Tagset::emptyElement{'hr'} exists and is true. $HTML::Tagset::emptyElement{'dl'} does not exist, and so is not true. hashset %HTML::Tagset::optionalEndTag This hashset lists tag-names for elements that can have content, but whose end-tags are generally, "safely", omissible. Example: $HTML::Tagset::emptyElement{'li'} exists and is true. hash %HTML::Tagset::linkElements Values in this hash are tagnames for elements that might contain links, and the value for each is a reference to an array of the names of attributes whose values can be links. hash %HTML::Tagset::boolean_attr This hash (not hashset) lists what attributes of what elements can be printed without showing the value (for example, the "noshade" attribute of "hr" elements). For elements with only one such attribute, its value is simply that attribute name. For elements with many such attributes, the value is a reference to a hashset containing all such attributes. hashset %HTML::Tagset::isPhraseMarkup This hashset contains all phrasal-level elements. hashset %HTML::Tagset::is_Possible_Strict_P_Content This hashset contains all phrasal-level elements that be content of a P element, for a strict model of HTML. hashset %HTML::Tagset::isHeadElement This hashset contains all elements that elements that should be present only in the 'head' element of an HTML document. hashset %HTML::Tagset::isList This hashset contains all elements that can contain "li" elements. hashset %HTML::Tagset::isTableElement This hashset contains all elements that are to be found only in/under a "table" element. hashset %HTML::Tagset::isFormElement This hashset contains all elements that are to be found only in/under a "form" element. hashset %HTML::Tagset::isBodyMarkup This hashset contains all elements that are to be found only in/under the "body" element of an HTML document. hashset %HTML::Tagset::isHeadOrBodyElement This hashset includes all elements that I notice can fall either in the head or in the body. hashset %HTML::Tagset::isKnown This hashset lists all known HTML elements. hashset %HTML::Tagset::canTighten This hashset lists elements that might have ignorable whitespace as children or siblings. array @HTML::Tagset::p_closure_barriers This array has a meaning that I have only seen a need for in "HTML::TreeBuilder", but I include it here on the off chance that someone might find it of use: When we see a "<p>" token, we go lookup up the lineage for a p element we might have to minimize. At first sight, we might say that if there's a p anywhere in the lineage of this new p, it should be closed. But that's wrong. Consider this document: <html> <head> <title>foo</title> </head> <body> <p>foo <table> <tr> <td> foo <p>bar </td> </tr> </table> </p> </body> </html> The second p is quite legally inside a much higher p. My formalization of the reason why this is legal, but this: <p>foo<p>bar</p></p> isn't, is that something about the table constitutes a "barrier" to the application of the rule about what p must minimize. So @HTML::Tagset::p_closure_barriers is the list of all such barrier-tags. hashset %isCDATA_Parent This hashset includes all elements whose content is CDATA. CAVEATS
You may find it useful to alter the behavior of modules (like "HTML::Element" or "HTML::TreeBuilder") that use "HTML::Tagset"'s data tables by altering the data tables themselves. You are welcome to try, but be careful; and be aware that different modules may or may react differently to the data tables being changed. Note that it may be inappropriate to use these tables for producing HTML -- for example, %isHeadOrBodyElement lists the tagnames for all elements that can appear either in the head or in the body, such as "script". That doesn't mean that I am saying your code that produces HTML should feel free to put script elements in either place! If you are producing programs that spit out HTML, you should be intimately familiar with the DTDs for HTML or XHTML (available at "http://www.w3.org/"), and you should slavishly obey them, not the data tables in this document. SEE ALSO
HTML::Element, HTML::TreeBuilder, HTML::LinkExtor COPYRIGHT &; LICENSE Copyright 1995-2000 Gisle Aas. Copyright 2000-2005 Sean M. Burke. Copyright 2005-2008 Andy Lester. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. ACKNOWLEDGEMENTS
Most of the code/data in this module was adapted from code written by Gisle Aas for "HTML::Element", "HTML::TreeBuilder", and "HTML::LinkExtor". Then it was maintained by Sean M. Burke. AUTHOR
Current maintainer: Andy Lester, "<andy at petdance.com>" BUGS
Please report any bugs or feature requests to "bug-html-tagset at rt.cpan.org", or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=HTML-Tagset <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=HTML-Tagset>. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. perl v5.16.2 2008-02-29 Tagset(3)
All times are GMT -4. The time now is 11:12 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy