0

I used this command but I am unable to print multiple values before each '.' This command is only printing the 192 of 192.168.113.2. I want to print the rest as well in the same line.

sudo tcpdump -i 2 -c 20 -n | awk -F '>' '{print $2}' | awk -F ':' '{print $1}' | awk -F '.' '{print $1}'

Please help.

Arjun Mathew Dan
  • 5,240
  • 1
  • 16
  • 27
user3481478
  • 387
  • 1
  • 3
  • 19

1 Answers1

1
sudo tcpdump -i 2 -c 20 -n | awk -F '>' '/>/{sub(".[^.]*:.*$", "", $2 ); print $2}'
pii_ke
  • 2,811
  • 2
  • 20
  • 30