473,573 Members | 2,733 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

extract from html

hi,
how can i extract the number between text1 and text2 in input.html
only the first time it occurs ignoring the rest?
preferably input.html would be a URL that stops downloading once a
match has occured, that would save a lot of bandwidth..
i guess html::parser would provide an option to work with a file while
it's downloading (?)

example
----

input.html:

bla..
text1 555 text2
bla
bla
text1 6000 text2
bla
EOF
output.txt
555
thanks for your help,
peter
Jul 19 '05 #1
2 2061

"Lydia Shawn" <ap******@hotma il.com> schrieb im Newsbeitrag
news:12******** *************** ***@posting.goo gle.com...
hi,
how can i extract the number between text1 and text2 in input.html
only the first time it occurs ignoring the rest?
This problem I would solve by using a Hash. You can just put a unique key
into it, while finding the same term
it will be overwritten, or you can ask the hash if the term already exist

# $term is taken from your text - inbeetween text1 / text2
if( exists $myHash{$term})
{
# ignore
}else
{
$myHash{$term} = $value;
}

The Rest of your question : I don´t know ... sorry
thanks for your help,
peter


no prob...but what is your real name ?
"Lydia Shawn" or Peter :-)

HTH
greets Michael
Jul 19 '05 #2

"Lydia Shawn" <ap******@hotma il.com> wrote in message
news:12******** *************** ***@posting.goo gle.com...
hi,
how can i extract the number between text1 and text2 in input.html
only the first time it occurs ignoring the rest?
preferably input.html would be a URL that stops downloading once a
match has occured, that would save a lot of bandwidth..
i guess html::parser would provide an option to work with a file while
it's downloading (?)


Take a look at the lwp-download script (in your perl bin directory)
as an example of a program that incrementally downloads a URL.
You can then search the contents for your text1 and text2 and stop if found.

The script uses LWP::UserAgent to do the download.

--
brian
Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
3899
by: Phong Ho | last post by:
Hi everyone, I try to write a simple web crawler. It has to do the following: 1) Open an URL and retrieve a HTML file. 2) Extract news headlines from the HTML file 3) Put the headlines into a RSS file. For example, I want to go to this site and extract the headlines: www.unstrung.com/section.asp?section_id=86
1
8617
by: Tim Smith | last post by:
I am looking to extract form element values from html, more generally I have a substring that identifies the beginning of a value and a string that identifies the end of value and I need to extract the substring. My ugly code looks like this: public static String getValue(String data, String begin, String end) { int delimPos =...
10
6864
by: mark4 | last post by:
Hello, Are there any utilities to help me extract Content from HTML ? I'd like to store this data in a database. The HTML consists of about 10,000 files with a total size of about 160 Mb. Each file is a thread from a message forum. Each thread has several contributions. The threads are in linear order of date posted with filenames such...
1
3445
by: Ori | last post by:
Hi, I have a HTML text which I need to parse in order to extract data from it. My html contain a table contains few rows and two columns. I want to extract the data from the 2nd column in the most efficient way (using Reg Ex.) either than using the "indexOf" function of String. Thanks,
0
1609
by: Vjay77 | last post by:
I posted this question, but I pressed 'post' and it disappeared. So once again: Problem: I need to go to lets say www.site.com/page.html Imagine that this html code is 6 mb long. I need to extract information between bytes 5000 and 5020.
3
2448
by: rahman | last post by:
I have few hundred HTML pages. I need to extract portion of each HTML page into a text/database/HTML files format. You can imagine it is very tedious to do one by one. Is there any automatic process/software/tool available that could help me extract information form mass HTML files? I can specify what portion of file to take or leave. I...
0
1188
by: manuel.reil | last post by:
Hello, currently i am developing a very small cms using python and cheetah. very early i have noticed that i was lacking the method to extract/recover the contents (html,text) from the html that is generated by cheetah and delivered to the site viewer. to explain it further: during the output processing by cheetah placeholders are...
1
3661
by: steveyjg | last post by:
I want to extract the following data from a retrieved html file and store the information as strings. 'get the text of "title" <h1 id="test_title">title</h1> 'get the contents of the value attribute <input name="test_code" type="text" value='<object </object>' > 'get the text of "category" or value of c <div class="smallText">
9
9258
by: flit | last post by:
Hello All, Using poplib in python I can extract only the headers using the .top, there is a way to extract only the message text without the headers? like remove the fields below: " Return-Path: X-Original-To: Received: from
1
4566
by: rcamarda | last post by:
I'd need to have a function that allows me to extract 'fields' from within the string I.E. (kinda pseudo code) declare @foo as varchar(100) set @foo = "Robert*Camarda*123 Main Street" select EXTRACT(@foo, '*', 2) ; -- would return 'Camarda' select EXTRACT(@foo, '*', 3) ;-- returns '123 Main Street' select EXTRACT(@foo, '*', 0) ;-- would...
0
7746
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7668
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7986
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8179
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7736
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
5258
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
2167
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1269
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
999
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.