Find the answer to your Linux question:
Results 1 to 2 of 2
I am searching the output of a scanned wifi device and wish to select a couple of pieces of information from different lines. I'm trying to locate the Signal Strength, ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux User jkwilborn's Avatar
    Join Date
    Nov 2012
    Posts
    278

    grep - multiple compare strings on a single invocation?


    I am searching the output of a scanned wifi device and wish to select a couple of pieces of information from different lines.

    I'm trying to locate the Signal Strength, which has a "Quality" indication on the same line. And the SSID on a different line. The following is the pair of output lines
    Code:
    Quality=44/70  Signal level=-66 dBm
    and
    Code:
    ESSID:"Jack's Router"
    I use
    Code:
    #iwlist wlan0 scan | grep -ivF SSID\0x0aQuality
    and it gives me everything, like it matches the new-line character. The i is for ignore case and the v is verbose, which doesn't seem to buy me much.

    Reading the man pages states something like the -F lets you search for multiple strings separated by a new-line character. I've even tried putting it in a script file and actually putting a new-line there which also did not work as the interpreter thought it was another command.

    If anyone has any thoughts about this please advise. Maybe I can't do this like I'm thinking?

    Thanks

    Jack

  2. #2
    Linux Enthusiast
    Join Date
    Jan 2005
    Location
    Saint Paul, MN
    Posts
    661
    Have you tried:

    Code:
    iwlist wlan0 | grep -E 'Quality|ESSID'
    or

    Code:
    iwlist wlan0 scan | grep 'Quality\|ESSID'
    Either of this should work for you.

Posting Permissions

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