HTML parsing by PERL


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting HTML parsing by PERL
# 1  
Old 02-21-2007
Question HTML parsing by PERL

i have a HTML report file..its in attachment(a part of the whole report is attached..name "input html.doc").also its source is attached in "report source code.txt"

i just want to seperate the datas like in first line it should be..

NHTEST-3848498958-NHTEST-10.2-no-baloo a
and so on for whole report

i have done that already using a perl script.its also attached ,named-"perl coding for parsing.txt"(its attached for ur help) Smilie

now suppose i have more than 1 file,ie 20 report in html format.and i have to compare different values of all the tables from different report files (ie,to compare buffer cache values from different report file).

so how to do that..plss give me some ideas. Smilie
i need a script to do this in unix or perl..can you help me in this regards.
waitin for ur reply
# 2  
Old 02-23-2007
Code:
sed -n "s/.*Buffer Cache:<\/TD><[^>]*> *\([0-9,]*[A-Za-z]*\)<\/TD><[^>]*> *\([0-9,]*[A-Za-z]*\).*/\1 \2/p" report source code.txt

This will give buffer cache values from report source code.txt
# 3  
Old 02-23-2007
Data for multiple file????

thanks for replying... Smilie
it will be valid for one report file only.but how can it be possible for 500 report files...i have to write a script which only can do it .then only can i compare the values Smilie

Last edited by avik1983; 02-23-2007 at 09:05 AM.. Reason: not completed query before
# 4  
Old 02-23-2007
If you kept all the report files in one directory then try this
Code:
sed -n "s/.*Buffer Cache:<\/TD><[^>]*> *\([0-9,]*[A-Za-z]*\)<\/TD><[^>]*> *\([0-9,]*[A-Za-z]*\).*/\1 \2/p" *

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Create html <ui> <li> by parsing text file

Hi you all, this is my first post in this forum. I'm italian (please forgive me) :-) so my english will fail to be correct... Anyway, let's get straight to the point! I have a text file like this: ,,,, Disney: 00961-002,,,, ,Pippo: 00531-002,,, ,,Pluto: 00238-002,, ... (5 Replies)
Discussion started by: alcresio
5 Replies

2. Linux

Parsing - export html table data as .csv file?

Hi all, Is there any out there have a brilliant idea on how to export html table data as .csv or write to txt file with separated comma and also get the filename of link from every table and put one line per rows each table. Please see the attached html and PNG of what it looks like. ... (7 Replies)
Discussion started by: lxdorney
7 Replies

3. UNIX for Dummies Questions & Answers

HTML parsing with UNIX shell script

Hi there, Infra/LEXUS0157/lexus0157.html-<tr><td>Minimum password age</td><td>3 days</td><td>Win2k8 Server</td></tr> How do I extract from this html with unix, I just need the 1.'Minimum password age' & 2. '3 days' parameter. Tried doing so with python, would like to have a better... (7 Replies)
Discussion started by: alvinoo
7 Replies

4. Shell Programming and Scripting

Perl syntax and html ole parsing

Hi gurus I am trying to understand some advanced (for me) perl constructions (syntax) following this tutorial I am trying to parse html: Using Mojo::DOM | Joel Berger say "div days:"; say $_->text for $dom->find('div.days')->each; say "\nspan hours:"; say $_->text for... (1 Reply)
Discussion started by: wakatana
1 Replies

5. Shell Programming and Scripting

Parsing HTML, get text between 2 HTML tags

Hi there, I'm quite new to the forum and shell scripting. I want to filter out the "166.0 points". The results, that i found in google / the forum search didn't helped me :( <a href="/user/test" class="headitem menu" style="color:rgb(83,186,224);">test</a><a href="/points" class="headitem... (1 Reply)
Discussion started by: Mysthik
1 Replies

6. Shell Programming and Scripting

BASH parsing for html tags

Hello can anyone help me parse this line. <tr><td>United States of America</td><td>Dollar</td><td>43.309</td></tr><tr><td>Japan</td><td>Yen</td><td>0.5579</td></tr> the line above did not break. so i would like to have a result like this United States of America Dollar 43.309 Japan... (3 Replies)
Discussion started by: doomsayer16
3 Replies

7. Shell Programming and Scripting

Html parsing - get line after specific string till a point

Hi all :) It sounds complex, for example I want to find the whole html file (there are 5 entries of this string and I need to get all of them) for the string "<td class="contentheading" width="100%">", get the next line from it only till the point that says "</td>", plus removing \t (tabs) ... (6 Replies)
Discussion started by: hakermania
6 Replies

8. UNIX for Advanced & Expert Users

html parsing using unix

hi all, I had raised the same question a few weeks back but forgot to mention a lot of points ... so i am raising a new thread furnishing my requirement ... sorry for that .... here is my problem. i have a html that look like below <tr class="modifications-oddrow"> <td... (2 Replies)
Discussion started by: sais
2 Replies

9. Shell Programming and Scripting

Parsing: How to go from HTML to CSV?

Dear all, I have to parse a large amount of html files, which I would like to transform into comma separated values. The html-files have the following structure: <tag1> CATEGORY_1 <tag2><tag3> HEADER_1 <tag4> <tag5> paragraph_1 <tag6> <tag5> paragraph_2 <tag6> <tag3>HEADER_2... (2 Replies)
Discussion started by: docdudetheman
2 Replies

10. Shell Programming and Scripting

Perl parsing compared to Ksh parsing

#! /usr/local/bin/perl -w $ip = "$ARGV"; $rw = "$ARGV"; $snmpg = "/usr/local/bin/snmpbulkget -v2c -Cn1 -Cn2 -Os -c $rw"; $snmpw = "/usr/local/bin/snmpwalk -Os -c $rw"; $syst=`$snmpg $ip system sysName sysObjectID`; sysDescr.0 = STRING: Cisco Internetwork Operating System Software... (1 Reply)
Discussion started by: popeye
1 Replies
Login or Register to Ask a Question