I have been trying to come up with a way to grab the NTP IP address in /etc/ntp.conf and use it in a variable for one of my scripts. Basically, this would grab it and auto populate a reports file with all network-like info, of which the NTP address is an entry.
*Also, for the network that I am working on, it doesn't connect to the Internet, so it doesn't have the usual FQDN's for the 'server' line.
I know sed and awk can grab the entry after "server" in ntp.conf, but there are a lot of words throughout the file with "server", which wouldn't work for me.
So, I was thinking of adding a commented out phrase to the end of the actual line to search for, so it would narrow it down to a unique line in the file:
Code:
server 192.168.1.3 #NTP_IP
...then, somehow, grab just the IP.
Can someone help me out, using the above example "server" entry and trim off the word "server" and "#NTP_IP", along with the spaces between those words?
thanks in advance...