I would like to use an awk statement to do the follow. Search for a specific line in a file that contains a word and print out the 5th item.
Easy enough. awk '/foo/ {print $5}' /tmp/log
what I would like to do is take it one step further and truncate the result down because the data is wrapped in brackets. example.
# awk '/foo/ {print $5}' /tmp/log
returns: [255.255.255.0]
I would i like to strip off the leading and trailing bracket.
Any assistance woudld be appreciated.
thanks
Easy enough. awk '/foo/ {print $5}' /tmp/log
what I would like to do is take it one step further and truncate the result down because the data is wrapped in brackets. example.
# awk '/foo/ {print $5}' /tmp/log
returns: [255.255.255.0]
I would i like to strip off the leading and trailing bracket.
Any assistance woudld be appreciated.
thanks