Sample Header Ad - 728x90

nmap output with awk to table

2 votes
3 answers
2420 views
I'm trying to get nmap output as a table or at least straight columns. I'm using this command:
$ sudo nmap -sn 192.168.103.0/24 \
    | awk '/Nmap scan report for/{printf $5;}/MAC Address:/{print ","substr($0, index($0,$3)) }' \
    | sort -t . -k 4,4n
However, I want it to show me:
ip    mac address     hostname
without () around the ip or hostname, but I can't manage to do it.
Asked by joni jino (31 rep)
May 10, 2020, 08:12 PM
Last activity: Jul 15, 2024, 12:38 PM