05-20-2016
Quote:
Originally Posted by
lxdorney
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.
Alas, there is indeed a "brilliant idea", but you probably are not going to like it: write a parser!
The solution you found (and which is similar to many others, including a few of my own) will work the way it is supposed to as long as the HTML source you feed it is "well-behaved". Well-behaved in this context means: it shall not contain constructs the creator of said solution did not think about in advance. If it does, the "solution" will perhaps break in one or the other way.
The reason is that "parsing" cannot be done with regular expressions, however cleverly arranged. "parsing" is a
recursive process and with anything short of a
recursive parser you might get
somewhere near a solution, but not a solution in the full meaning of the word. If you are interested in why:
here is it in length.
So, if you can live with some shortcomings like the chance that the "solution" you end up with will not always work, you can use what you found. If you need a real solution: i suggest the "Dragon Book" ("Principles of Compiler Design"; Aho, Sethi, Ullmann) as the best reference for building parsers, lexical analysers and similar programs.
I hope this helps.
bakunin
This User Gave Thanks to bakunin For This Post:
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hello people,
Need favour. The problem I have is that, I need to develop a unix shell script that performs recurring exports of data from a csv file to an oracle database. Basically, the csv file contains just the first name and last name will be dumped to an Unix server. The data from these... (3 Replies)
Discussion started by: vinayagan
3 Replies
2. Shell Programming and Scripting
Hello All,
I have a perl script that prints a HMTL table. I want to convert this data into a report and this want to export this information into Excel. How can I do this?
Regards,
garric (3 Replies)
Discussion started by: garric
3 Replies
3. Shell Programming and Scripting
Hi
I need help on this. Its very urgent for me.. please try to help me out..
I have data in tables in DB2 database. I would like to export the data from DB2 tables into a text file, which has to be space delimited. so that I can carry out awk, grep operations on that file. I tried to export... (2 Replies)
Discussion started by: ss3944
2 Replies
4. Shell Programming and Scripting
Hi ,
I would like to get some suggestion from the experts.
My requirement is to export oracle table data as an xml file.
Any unix/linux tools, scripts available?
Regards, (2 Replies)
Discussion started by: LinuxLearner
2 Replies
5. UNIX for Dummies Questions & Answers
Hi
I need to write a bash script to take the data stored in 3 oracle tables .. and filter them and store the results in a csv file.
It is an Oracle database
Thank you (1 Reply)
Discussion started by: ladyAnne
1 Replies
6. Shell Programming and Scripting
Hi. I need to create html table from file which contains data. No awk please :) In example,
->cat file
num1 num2 num3
23 3 5
2 3 4 (between numbers and words single TAB).
after running mycode i need to get (heading is the first line):
<table>... (2 Replies)
Discussion started by: Manu1234567
2 Replies
7. Shell Programming and Scripting
Hi ,
I need an help in perl scripting.
I have an perl script written and i have an for loop in that ,where as it writes some data to a file and it has details like below.
cat out.txt
This is the first line
this is the second line.
.....Now, this file needs to be send in mail in HTML... (2 Replies)
Discussion started by: scott_cog
2 Replies
8. Shell Programming and Scripting
Hi All ,
I am stuck on the below situation.I have a table called "test" which are created on hive.I need to export the data from hive to a file(test.txt) on local unix system.I have tried the below command ,but its giving the exception .
hive -e "select * from test " > /home/user/test.txt ;
... (1 Reply)
Discussion started by: STCET22
1 Replies
9. Shell Programming and Scripting
Greetings,
After a few hours of trial and error, I decide to ask for some help.
I am new to AWK and shell script, so please don't laugh :p
I made the below script, to gather data from some logs and have the output into a CSV file :
#!/bin/sh
#Script to collect Errors
... (9 Replies)
Discussion started by: Yagami_Sama
9 Replies
10. UNIX for Beginners Questions & Answers
HI ,
I have a HTML tables as below.
It has 2 tables ,I want to extract the second table .
Please help me in doing it.
<html>
<body>
<b><br>Running Date: </b>11-JAN-2019 03:07</br>
<h2> Schema mapping and info </h2>
<BR><TABLE width="100%" class="x1h" cellpadding="1"... (3 Replies)
Discussion started by: deepti01
3 Replies
DGELS(l) ) DGELS(l)
NAME
DGELS - solve overdetermined or underdetermined real linear systems involving an M-by-N matrix A, or its transpose, using a QR or LQ fac-
torization of A
SYNOPSIS
SUBROUTINE DGELS( TRANS, M, N, NRHS, A, LDA, B, LDB, WORK, LWORK, INFO )
CHARACTER TRANS
INTEGER INFO, LDA, LDB, LWORK, M, N, NRHS
DOUBLE PRECISION A( LDA, * ), B( LDB, * ), WORK( * )
PURPOSE
DGELS solves overdetermined or underdetermined real linear systems involving an M-by-N matrix A, or its transpose, using a QR or LQ factor-
ization of A. It is assumed that A has full rank. The following options are provided:
1. If TRANS = 'N' and m >= n: find the least squares solution of
an overdetermined system, i.e., solve the least squares problem
minimize || B - A*X ||.
2. If TRANS = 'N' and m < n: find the minimum norm solution of
an underdetermined system A * X = B.
3. If TRANS = 'T' and m >= n: find the minimum norm solution of
an undetermined system A**T * X = B.
4. If TRANS = 'T' and m < n: find the least squares solution of
an overdetermined system, i.e., solve the least squares problem
minimize || B - A**T * X ||.
Several right hand side vectors b and solution vectors x can be handled in a single call; they are stored as the columns of the M-by-NRHS
right hand side matrix B and the N-by-NRHS solution matrix X.
ARGUMENTS
TRANS (input) CHARACTER
= 'N': the linear system involves A;
= 'T': the linear system involves A**T.
M (input) INTEGER
The number of rows of the matrix A. M >= 0.
N (input) INTEGER
The number of columns of the matrix A. N >= 0.
NRHS (input) INTEGER
The number of right hand sides, i.e., the number of columns of the matrices B and X. NRHS >=0.
A (input/output) DOUBLE PRECISION array, dimension (LDA,N)
On entry, the M-by-N matrix A. On exit, if M >= N, A is overwritten by details of its QR factorization as returned by DGEQRF; if M
< N, A is overwritten by details of its LQ factorization as returned by DGELQF.
LDA (input) INTEGER
The leading dimension of the array A. LDA >= max(1,M).
B (input/output) DOUBLE PRECISION array, dimension (LDB,NRHS)
On entry, the matrix B of right hand side vectors, stored columnwise; B is M-by-NRHS if TRANS = 'N', or N-by-NRHS if TRANS = 'T'.
On exit, B is overwritten by the solution vectors, stored columnwise: if TRANS = 'N' and m >= n, rows 1 to n of B contain the least
squares solution vectors; the residual sum of squares for the solution in each column is given by the sum of squares of elements
N+1 to M in that column; if TRANS = 'N' and m < n, rows 1 to N of B contain the minimum norm solution vectors; if TRANS = 'T' and m
>= n, rows 1 to M of B contain the minimum norm solution vectors; if TRANS = 'T' and m < n, rows 1 to M of B contain the least
squares solution vectors; the residual sum of squares for the solution in each column is given by the sum of squares of elements
M+1 to N in that column.
LDB (input) INTEGER
The leading dimension of the array B. LDB >= MAX(1,M,N).
WORK (workspace/output) DOUBLE PRECISION array, dimension (LWORK)
On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
LWORK (input) INTEGER
The dimension of the array WORK. LWORK >= max( 1, MN + max( MN, NRHS ) ). For optimal performance, LWORK >= max( 1, MN + max( MN,
NRHS )*NB ). where MN = min(M,N) and NB is the optimum block size.
If LWORK = -1, then a workspace query is assumed; the routine only calculates the optimal size of the WORK array, returns this
value as the first entry of the WORK array, and no error message related to LWORK is issued by XERBLA.
INFO (output) INTEGER
= 0: successful exit
< 0: if INFO = -i, the i-th argument had an illegal value
LAPACK version 3.0 15 June 2000 DGELS(l)