awk + find hostname after strings

1

please advice how to print the hostname ( NODE100 ) from the tnsnames.ora file by awk or sed

I mean I want to get each hostname after

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

thx

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

david

Posted 2011-06-21T08:45:14.810

Reputation: 65

Answers

2

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

RedGrittyBrick

Posted 2011-06-21T08:45:14.810

Reputation: 70 632