shell script to parse html file

Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users shell script to parse html file
# 1  
Old 08-26-2009
shell script to parse html file

hi all,

i have a html file something similar to this.
<tr class="evenrow">
<td class="data">added</td><td class="data"></td>
<td class="data">filename.sql</td><td class="modifications-data">08/25/2009 07:58:40</td><td class="data">Added TK prof script</td>
<tr class="oddrow">
<td class="data">added</td><td class="data"></td><td class="modifications-data">filename2.sql</td><td class="modifications-data">08/25/2009 07:58:40</td><td class="data">Added TK prof script</td>

and so till filname100.sql..
i need to fetch the "filename1-100.sql" ... the rest of the html can be ignored ... can anyone help me out with doing this.

Last edited by vgersh99; 08-26-2009 at 01:05 PM.. Reason: code tags, PLEASE!
# 2  
Old 08-26-2009
To keep the forums high quality for all users, please take the time to format your posts correctly.

First of all, use Code Tags when you post any code or data samples so others can easily read your code. You can easily do this by highlighting your code and then clicking on the # in the editing menu. (You can also type code tags [code] and [/code] by hand.)

Second, avoid adding color or different fonts and font size to your posts. Selective use of color to highlight a single word or phrase can be useful at times, but using color, in general, makes the forums harder to read, especially bright colors like red.

Third, be careful when you cut-and-paste, edit any odd characters and make sure all links are working property.

Thank You.

The UNIX and Linux Forums

---------- Post updated at 11:10 AM ---------- Previous update was at 11:06 AM ----------

assuming all the 'files' you're interested in are '.sql' files:
nawk -F'[<>]' '{for(i=1;i<=NF;i++) if($i ~ /.sql$/) print $i}' myHTMLfile.html

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Multiline html tag parse shell script

Hello, I want to parse the contents of a multiline html tag ex: <html> <body> <p>some other text</p> <div> <p class="margin-bottom-0"> text1 <br> text2 <br> <br> text3 </p> </div> </body> (15 Replies)
Discussion started by: SorcRR
15 Replies

2. Shell Programming and Scripting

awk to parse html file

Is it possible in awk to parse a webpage (EDAR Gene Sequencing - Genetic Testing Company | The DNA Diagnostic Experts | GeneDx), the source code is attached. <title> EDAR Gene Sequencing <dt>Test Code:</dt> <dd>156 </dd> <dt>Turnaround Time:</dt> <dd>6-8 weeks </dd> ... (4 Replies)
Discussion started by: cmccabe
4 Replies

3. Shell Programming and Scripting

Parse excel file with html on each cell

<DIV><P>Pré-condição aceder ao ecrã Home do MRS.</P></DIV><DIV><P>OK.</P></DIV><DIV><P>Seleccionar Pesquisa de Recepção Directa.</P></DIV><DIV><P>Confirmar que abriu ecrã de Recepção Directa.</P></DIV><DIV> (6 Replies)
Discussion started by: oliveiraum
6 Replies

4. UNIX for Dummies Questions & Answers

Help to parse csv file with shell script

Hello ! I am very aware that this is not the first time this question is asked here, because I have already read a lot of previous answers, but none of them worked, so... As said in the title, I want to read a csv file with a bash script. Here is a sample of the file: ... (4 Replies)
Discussion started by: Grhyll
4 Replies

5. Shell Programming and Scripting

Bash Shell Script to parse file

Raw Results: results|192.168.2||general/udp|10287|Security Note|For your information, here is the traceroute from to : \n192.168.2.24\n192.168.2.1\n\n results|192.168.2||ssh (22/tcp)|22964|Security Note|An SSH server is running on this port.\n... (2 Replies)
Discussion started by: jroberson
2 Replies

6. Shell Programming and Scripting

Parse file from 2nd line in shell script

Hi, I need to parse input file from 2nd line. Input file contents are, ABC123;20100913115432;2000000;NO; 04;AAA;09;DDD;601020304;AAAA;1;OPTA1;OPTA2;;; 04;BBB;09;BBB;601020304;BBBB;0;OPTB1;OPTB2;OPTB3;OPTB4;OPTB5; 04;CCC;09;DDD;601020304;CCCC;1;;;;; For each line, 1] I need to check... (17 Replies)
Discussion started by: Poonamol
17 Replies

7. Shell Programming and Scripting

Parse XML file in shell script

Hi Everybody, I have an XML file containing some data and i want to extract it, but the specific issue in my file is that the data is repeated some times like the following example : <section1> <subsection1> X=... Y=... Z=... <\subsection1> <subsection2> X=... Y=... Z=...... (2 Replies)
Discussion started by: yassine
2 Replies

8. Shell Programming and Scripting

Return to HTML file from shell script

Hi! I'm writing a simple script which I call on using a simple html button. The script also recives a simple argument. After the script is done I immediately want to return to my html page. But I dont know how to do that! #!/bin/sh echo "Content-type: text/html" echo "" if then echo... (1 Reply)
Discussion started by: crille
1 Replies

9. Shell Programming and Scripting

Help!!! Shell script to parse data file.

I am faced with a :confused: tricky problem to parse a data file ( May not be a tricky problem to the scripting guru's ). Here is what I am faced with. I have a file with multiple rows of data and the rows are not of fixed length. "|" is used as a delimiters for individual columns and each row... (3 Replies)
Discussion started by: yajaykumar
3 Replies

10. Shell Programming and Scripting

Parse a string in XML file using shell script

Hi! I'm just new here and don't know much about shell scripting. I just want to ask for help in creating a shell script that will parse a string or value of the status in the xml file. Please sample xml file below. Can you please help me create a simple script to get the value of status? Also it... (46 Replies)
Discussion started by: ayhanne
46 Replies
Login or Register to Ask a Question