awk not parse the output of nc command!
I try to parse the output of nc command
This is code : Code:
nc -v localhost -z 6660-6661,80 | awk '/succeeded/' Can somebody help me understand what happen or how to use it? Thank you . Regards . |
Hi,
If you want to get the list of succeeded connections, use grep instead of awk like this: Code:
nc -v localhost -z 6660-6661,80 | grep "succeeded" Eric |
To me the syntax of the port argument is invalid and no standard output is piped to awk. Looking at the man page of nc, they don't specify you can use a comma to separate the list of ports to scan.
|
This is just one example with comma . My problem is output of nc command.
This output not parse with awk. Quote:
|
The problem cannot be awk, but what passes through the pipe as standard output. Some commands send terminal output to standard error, so that a redirection is needed, but nc is not one of these. What do you get by running the nc command alone (without piping to awk)?
|
Quote:
|
Quote:
That wasn't the question colucix asked. He was asking you what the output of the nc command is (without the pipe). Run the nc command without piping it and post the output. I'm kind of sure that you'll need to put a space after the comma (at least on my Debian I had to). If I don't have a space after the comma only the first port queried gives output, disregarding the rest. With a space I get all ports from a list. Next we'll worry about the output filtering. Kind regards, Eric |
All times are GMT -5. The time now is 05:11 PM. |