0

In shell script, I used 2 different SQL query & output of these 2 files in HTML format like (eg- ab.html, cd.html). Before DML operation 1 SQL query will run then after DML operation another query will run. Shell script as ->

#/bin/ksh

ab=$(SQLPLUS -s <username>/<password>@DB <<EOF
set heading ON
set trimspool OFF
SET MARKUP HTML ON
set feedback off
spool ab.html
select col_1, col_2, col_3 from <tab>;
spool off;
exit;
EOF)

echo "$ab" > ab.html

----- DML operation perform

cd=$(SQLPLUS -s <username>/<password>@DB <<EOF
set heading ON
set trimspool OFF
SET MARKUP HTML ON
set feedback off
spool cd.html
select col_4 from <tab>;
spool off;
exit;
EOF)

echo "$cd" > cd.html

cat ab.html cd.html > output.html
exit 0

Then getting output.html file as ->

 ______________________________
| col_1     | col_2  |   col_3 |
| .....     | ...... |   ..... |
| .....     | ...... |   ..... |
|___________|________|_________|
 ______________________________              
|             col_4            |
|             ......           |
|______________________________|

But I want final output.html like col_1, col_2, col_3, col_4 column in one table like below ->

 ______________________________________
| col_1     | col_2  |   col_3  | col_4|
| .....     | ...... |   .....  | .....|
| .....     | ...... |   .....  | .....|
|___________|________|__________|______|

Could you please help me how to merge these 2 HTML file into one output HTML file so that we can able to see like above format. I just draw HTML table as example but internal border always comes in HTML table, so please don't look HTML table format that I used.

2
  • Is this the same DB? Is it the same <tab>? Why don't you just merge the queries? select col1, col2, col3, col4 from <tab> Commented Mar 2, 2020 at 14:09
  • If you want help writing a script to parse some HTML, you have to show us that HTML rather than an image of the table that that HTML would display in a browser. Commented Mar 2, 2020 at 14:32

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.