Hi all,
I am fairly new to scripting, but I do try and script as much as possible but the more advanced stuff does tend to boggle my mind a bit.
I am at a bit of a loss with this one.
I get entries in my DNS logs, like the below:
I want to extract only the IP address, without the hashes or port numbers after it, and output the IP addresses to a file.
I started with a for loop that looks like so:
for x in $(tail -f /var/log/messages | awk '{print $7}') ; do sed -e "s/#*/ /g" $x >> /temp.txt ; done
I am not too sure if sed or awk is the right commands to use here and if there might be an easier way to do this.
Thanks