Find the answer to your Linux question:
Results 1 to 2 of 2
iwconfig displays all of my network interfaces, not just the ones with wireless extensions. I wouldn't mind that, if it was actually possible to grep out the right, wireless one. ...
  1. #1
    Just Joined!
    Join Date
    Mar 2008
    Posts
    2

    iwconfig - getting rid of the useless stuff in the output

    iwconfig displays all of my network interfaces, not just the ones with wireless extensions. I wouldn't mind that, if it was actually possible to grep out the right, wireless one.

    An example:
    Code:
    $ iwconfig | grep ESSID | cut -f 1 -d ' '
    lo        no wireless extensions.
    
    eth0      no wireless extensions.
    
    wmaster0  no wireless extensions.
    
    pan0      no wireless extensions.
    
    eth1
    As you can see, the right name (eth1) is displayed, but along with it iwconfig echoes a bunch of useless stuff.

    How can I get rid of it?

    I've found out that saving the grepped iwconfig output to a variable does actually work, but the script still echoes the non-wireless interfaces, for instance:

    Code:
    $ interface=$(iwconfig | grep ESSID | cut -f 1 -d ' ')
    lo        no wireless extensions.
    
    eth0      no wireless extensions.
    
    wmaster0  no wireless extensions.
    
    pan0      no wireless extensions.
    
    $ echo $interface
    eth1
    How can I prevent it from doing so?

    Thanks.

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    What does this have to do with programming and scripts? Please move this thread to the wireless forum for appropriate help.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...