[Solved]Netcat grep awk doesnt work ! what to do?

How do i grep output in netcat
i tried this

root@my:~# netcat -xzv -w 2 192.168.222.1 80 | awk '{print $4}' | awk -F "/" '{print $1,$2,$3}' | awk -F ":" '{print $1,$2,$3,$4}' | awk '{print $3}'
my.lan [192.168.222.1] 80 (www) open
root@my:~# netcat -xzv -w 2 192.168.222.1 80 | awk -F ":" '{print $1,$2,$3,$4}'
my.lan [192.168.222.1] 80 (www) open
root@my:~# netcat -xzv -w 2 192.168.222.1 80 | awk -F "" '{print $1,$2,$3,$4}'
my.lan [192.168.222.1] 80 (www) open
root@my:~# netcat -xzv -w 2 192.168.222.1 80 | awk -F " " '{print $1,$2,$3,$4}'
my.lan [192.168.222.1] 80 (www) open
root@my:~#

also i tried grep and the same thing

Just a wild guess.... Could it be that the output was send to stderr and not stdout? Did you have tried to redirect stderr to stdout and then awk on that?

3 Likes

yes ! this work

netcat -zv -w 2 192.168.222.1 81 2>&1 | grep 'open'
1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.