顯示結果 
搜尋替代 
您的意思是 

script 寫法二

script 寫法二

我的output 如下:

我要只要取,從SYSTEM開始往下7列,其他都不要,請問要怎樣寫比較好

Connected to:

Oracle Database 10g Enterprise Edition Release 10.1.0.3.0 - Production

With the Partitioning, OLAP and Data Mining options

SQL> select name from v$tablespace;



NAME

------------------------------------------------

SYSTEM

UNDOTBS1

SYSAUX

USERS

TEMP

EXAMPLE

LOGMNRTS



7 rows selected.
1 回覆

script 寫法二

簡單的程式

================================================

#!/bin/ksh

TMP_FILE=/tmp/$$.TXT



`sqlplus -s username/passwd@XXXXX > ${TMP_FILE} << eof

set pagesize 0 linesize 2048 heading off

select name from v$tablespace;

exit

eof`



integer NSYSTEM=`grep -n "SYSTEM" ${TMP_FILE}|awk -F: '{print $1}'`

integer NEND=${NSYSTEM}+6

sed -n "${NSYSTEM}","${NEND}"p ${TMP_FILE}

rm -f ${TMP_FILE}

================================================



如果你的v$tablespace資料只有7筆的話, 只需要自sqlplus至eof就可以了. header會被濾掉.
//Add this to "OnDomLoad" event