我想从AIX的拖 output产出中抽取10.2.0.
,因此,我写了<条码>:tnsping tucson , grep 》>a wk{印有9},但有时在其他平台上,如其他平台,例如: 栏目各不相同,因此我无法在任何地方使用<代码>{印有9}。 有这样的办法:
- The command looks for
Version
- and then just after it prints whatever number comes up (including ".")
还是任何其他方法?
TNS Ping Utility for IBM/AIX RISC System/6000: Version 10.2.0.4.0 - Production on 16-NOV-2011 16:19:02
Copyright (c) 1997, 2007, Oracle. All rights reserved.
Used parameter files:
Used HOSTNAME adapter to resolve the alias
Attempting to contact (DESCRIPTION=(CONNECT_DATA=(SERVICE_NAME=bluebird.informatica.com))(ADDRESS=(PROTOCOL=TCP)(HOST=10.65.40.235)(PORT=1521)))
TNS-12535: TNS:operation timed out
下面请参阅AIX、HPUX和LC:
tnsping tucson | grep Version | awk -F Version {print $2} | awk {print $1}
但我在<>SunOS上发现了一个错误。 我想要的是那些将针对六氯环己烷、六氯环己烷-未爆弹药、AIX和SunOS的工作。
zenvo% tnsping tucson | grep Version | awk -F Version {print $2} | awk {print $1}
awk: syntax error near line 1
awk: bailing out near line 1
Update after Shelter s answer
林丹
tnsping tucson | grep Version | awk -F Version {print $2} | awk {print $1}
SunOS:
tnsping tucson | grep Version | nawk -F Version {print $2} | nawk {print $1}