I have this in log file /var/log/maillog
XXX YYY ZZZ [55.66.77.88]:15214 I=[11.22.33.44]:25 AAA BBB CCC
I need awk/sed operation on this, so that it retrieves only the first IP.
cat /var/log/maillog | sed_operation
55.66.77.88
I have this in log file /var/log/maillog
XXX YYY ZZZ [55.66.77.88]:15214 I=[11.22.33.44]:25 AAA BBB CCC
I need awk/sed operation on this, so that it retrieves only the first IP.
cat /var/log/maillog | sed_operation
55.66.77.88
awk -F"[][]" '{print $2}' /var/log/maillog
55.66.77.88
perl -lne 'print $1 if /(\d+\.\d+\.\d+\.\d+)/' /var/log/maillog