w*m 发帖数: 1806 | 1 for example,
#/!bin/csh
sqlplus -silent id/password@oracel_instance <
"%s",$1;}' | echo(I want to set xx=..)
select id from table;
EOF
awk处理后的结果,如何赋值给一个变量呢? | S*A 发帖数: 7142 | 2 不会用 csh.
bash 里面大概是
varname=`sqlplus -silent id/password@oracel_instance <
printf("%s",$1;}'
"%s",$1;}' `
printf(
【在 w*m 的大作中提到】 : for example, : #/!bin/csh : sqlplus -silent id/password@oracel_instance <: "%s",$1;}' | echo(I want to set xx=..) : select id from table; : EOF : awk处理后的结果,如何赋值给一个变量呢?
| l*******G 发帖数: 1191 | 3 use ` ` or $()
such as
varname=$(sqlplus -silent id/password@oracel_instance <
echo $varname | v*****r 发帖数: 1119 | 4 1. 简单的 query, 直接在 query 里dynamic赋值
sqlplus -silent id/password@oracel_instance <
select 'foo='id from table;
...
EOF
2.复杂的 Query ,re-direct here document output to a temporary file and awk
the temporary file
sqlplus -silent id/password@oracel_instance < tempfile
select column1,column2...,columnN from table;
...
EOF
awk .... tempfile
printf(
【在 w*m 的大作中提到】 : for example, : #/!bin/csh : sqlplus -silent id/password@oracel_instance <: "%s",$1;}' | echo(I want to set xx=..) : select id from table; : EOF : awk处理后的结果,如何赋值给一个变量呢?
|
|