You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

7 lines
431 B

2 years ago
  1. #!/bin/bash
  2. nmap -sn `ip route | tail -1 | cut -d ' ' -f1` | sed -n 'n;p' | cut -c 22- | head -n -1 | awk '{tmp=$1; $1=$2; $2=tmp; gsub("\\(","",$1); gsub("\\)","",$1); printf "%-15s %s\n", $1, $2}' | sed 's/^ *//'
  3. # sed -n 'n;p' => FILTER odd lines
  4. # awk '{tmp=$1; $1=$2; $2=tmp; gsub("\\(","",$1); gsub("\\)","",$1); printf "%-15s %s\n", $1, $2}' => SWAP words and remove parenthesis
  5. # sed 's/^ *//' => REMOVE starting spaced