awk + ​​在字符串后查找主机名

awk + ​​在字符串后查找主机名

请指导如何使用 awk 或 sed 从 tnsnames.ora 文件中打印主机名(NODE100)

我的意思是我想要获取每个主机名

    "HOST =" or "HOST=" or "HOST        =" etc

谢谢

 EXTPROC_CONNECTION_DATA =
   (DESCRIPTION =
      (ADDRESS_LIST =
       (ADDRESS = (PROTOCOL = TCP)(HOST = NODE100 )(PORT = 1521))
      )
     (CONNECT_DATA =
       (SERVICE_NAME = PLSExtProc)
     )
   )

答案1

 perl -n -e '/HOST *= *([^ )]+)/ && print "$1\n"' tnsnames.ora

相关内容