Extract ip address ,

Thanks appreciate your help. It works like charm.

Solaris
Q: (parenthesized parts 1 of matches(regex("^server[[:space:]]+(([[:alnum:]]|\.|-|_)+)")) of it) of lines starting with "server" of file "/etc/inet/ntp.conf"
A: 10.254.254.1
A: 10.254.254.2
A: 10.254.254.3
T: 4232

Q: (parenthesized parts 1 of matches(regex("^server[[:space:]]+([^[:space:]]+)")) of it) of lines starting with "server" of file "/etc/inet/ntp.conf"
A: 10.254.254.1
A: 10.254.254.2
A: 10.254.254.3

AIX
Q: (parenthesized parts 1 of matches(regex("^server[[:space:]]+(([[:alnum:]]|\.|-|_)+)")) of it) of lines starting with "server" of file "/etc/ntp.conf"
A: 10.254.254.233
T: 6160

Q: (parenthesized parts 1 of matches(regex("^server[[:space:]]+([^[:space:]]+)")) of it) of lines starting with "server" of file "/etc/ntp.conf"
A: 10.254.254.233
T: 1482

Q: preceding texts of firsts " " of following texts of firsts "server " of lines starting with "server" of file "/etc/ntp.conf"
T: 2208

Q: (substrings separated by " " of substrings separated by "%09" of it ) whose (it contains ".") of lines starting with "server" of file "/etc/ntp.conf"
A: 10.254.254.233

hp-ux
Q: preceding texts of firsts " " of following texts of firsts "server " of lines starting with "server" of file "/etc/ntp.conf"
T: 115379

Q: (parenthesized parts 1 of matches(regex("^server[[:space:]]+(([[:alnum:]]|\.|-|_)+)")) of it) of lines starting with "server" of file "/etc/ntp.conf"
A: time1.xyz.com
A: time2.xyz.com
T: 27258

Q: (parenthesized parts 1 of matches(regex("^server[[:space:]]+([^[:space:]]+)")) of it) of lines starting with "server" of file "/etc/ntp.conf"
A: time1.xyz.com
A: time2.xyz.com
T: 14197


Q: (substrings separated by " " of substrings separated by "%09" of it ) whose (it contains ".") of lines starting with "server" of file "/etc/ntp.conf"
A: time1.xyz.com
A: time2.xyz.com
T: 20062
1 Like