html parsing using unix


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users html parsing using unix
# 1  
Old 09-07-2009
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 class="modifications-data">added</td><td class="modifications-data">abc@xyz.com</td><td class="modifications-data">/trunk/src/DELIVERIES/Framework/filename.sql</td><td class="modifications-data">25/08/2009 07:58:40</td><td class="modifications-data">comments1</td>
</tr>
<tr class="modifications-evenrow">
<td class="modifications-data">deleted</td><td class="modifications-data">sam@xyz.com</td><td class="modifications-data">/trunk/src/DELIVERIES/Framework/filename2.sql</td><td class="modifications-data">25/08/2009 07:58:40</td><td class="modifications-data">comments2</td>
</tr>
<tr class="modifications-oddrow">
<td class="modifications-data">modified</td><td class="modifications-data">robbin@xyz.com</td><td class="modifications-data">/trunk/src/DELIVERIES/Framework/filename3.sql</td><td class="modifications-data">25/08/2009 07:58:40</td><td class="modifications-data">comments3</td>

i need to get the names of the files ending with .sql, but only if the
<td class="modifications-data"> value is added or modified ...... if it is deleted then that value should not be displayed....

thanks and regards
# 2  
Old 09-07-2009
try this command:

Code:
sed -ne '/<td class="modifications-data"> *modified/p' -e '/<td class="modifications-data"> *added/p' <<input_html_file>>|sed -e 's/.*>\([^<].*\.sql\) *<.*/\1/g'

# 3  
Old 09-07-2009
Parsing with tools like awk, sed, shell might not be scalable or in other words that might not be the right tool to do the job.

Instead try with some CPAN modules that works with XML::Parser etc
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. 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

9. Shell Programming and Scripting

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... (3 Replies)
Discussion started by: avik1983
3 Replies

10. UNIX for Dummies Questions & Answers

HTML-CGI on Unix

AAAHHH!! I've made a perl program that you can run on a web browser. This program needs to be run everyday, and I don't want to have to run it everyday. The problem is when I try running the program from my terminal, all it does is print stuff to the terminal page (the program involves a lot of... (4 Replies)
Discussion started by: sstevens
4 Replies
Login or Register to Ask a Question