Shell 只需要从输出中获取值
当我通过shell脚本执行DB查询时,我得到以下输出Shell 只需要从输出中获取值,shell,sqlplus,Shell,Sqlplus,当我通过shell脚本执行DB查询时,我得到以下输出 SQL*Plus: Release 10.2.0.5.0 - Production on Thu Jun 22 02:50:47 2017 Copyright (c) 1982, 2010, Oracle. All Rights Reserved. Connected to: Oracle Database 10g Release 10.2.0.5.0 - 64bit Production SQL> SUM(SUM(CURR
SQL*Plus: Release 10.2.0.5.0 - Production on Thu Jun 22 02:50:47 2017
Copyright (c) 1982, 2010, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Release 10.2.0.5.0 - 64bit Production
SQL>
SUM(SUM(CURRENTCOUNT))
----------------------
1182870
SQL> Disconnected from Oracle Database 10g Release 10.2.0.5.0 - 64bit Production
我需要使用sed删除其中的其他内容,只获得1182870
我曾经
要禁止在sqlplus报告中显示列标题,请输入: 出发
您的命令只需稍作更改
<sql-command>|sed -n '/CURRENTCOUNT/{n;n;p}'
1182870
sql命令| grep-a2'^SUMSUM'| tail-n1 | grep-o'[0-9]*'
<sql-command>|sed -n '/CURRENTCOUNT/{n;n;p}'
1182870