I am running iwconfig | grep -v "no wireless extensions"
but can't get the -v option to work as expected. I want to exclude lines including "no wireless extensions", i.e., I want to display only the active/working wireless interface or whatever this should be called.
In the beginning I thought perhaps the command outputs to a stream different than the one piped to grep, so I tried cat myFile | grep -v myExclusionPattern
. This works as expected, so I concluded -v
does what I expect it does.
I then tried iwconfig | grep "no wireless extensions"
and again the result is the expected - meaning the output of iwconfig is what is piped to grep.
So I am left with the question why specifically -v
is not working when piping the results of iwconfig
to grep
.
Here is my output to iwconfig:
enp4s0 no wireless extensions.
docker0 no wireless extensions.
lo no wireless extensions.
wlp5s0 IEEE 802.11 ESSID:"myEssid"
Mode:Managed Frequency:5.24 GHz Access Point: 74:83:C2:75:86:2A
Bit Rate=6 Mb/s Tx-Power=30 dBm
Retry short limit:7 RTS thr:off Fragment thr:off
Power Management:on
Link Quality=59/70 Signal level=-51 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:747 Missed beacon:0
Summarizing:
grep -v
works for me when I pipe togrep
the output of a file withcat
.- I can't reproduce the same behavior as in (1) when piping the output of
iwconfig
togrep
.
I read the following questions on grep -v, but am not able to find the answer to the above in any of them: