SQLクエリ出力の2つのHTMLファイルをシェルスクリプトの1つのデフォルトのHTML出力ファイルに変換します。

SQLクエリ出力の2つのHTMLファイルをシェルスクリプトの1つのデフォルトのHTML出力ファイルに変換します。

シェルスクリプトでは、2つの異なるSQLクエリをHTML形式で使用しています(たとえば(eg- ab.html, cd.html)、DML操作の前に1つのSQLクエリが実行され、DML操作の後に別のクエリが実行されます。)シェルスクリプトは - >

#/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

次に、output.htmlファイルを次のようにインポートします - >

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

output.htmlしかし、次のようにテーブルにcol_1、col_2、col_3、col_4などの列を作成したいと思います。 ->

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

上記の形式を見るために、この2つのHTMLファイルを1つの出力HTMLファイルにマージする方法を教えてください。例としてHTMLテーブルを描いただけですが、HTMLテーブルには常に内側の枠線が表示されますので、私が使用するHTMLテーブル形式を見ないでください。

ベストアンサー1

おすすめ記事