Basically, this sed script outputs something like this:
[essid1] Address=00:E4:55:66:16:71 [essid2 with spaces available] Address=00:E4:55:66:16:72 [essid2-whatever] Address=00:E4:55:66:16:73 [] Address=00:E4:55:66:16:71
As you can see it works with ESSID:"" too. Enough talk, here are these lines:
#   Copyright (c) 2010 Sebastián Treu.
#
#   This program is free software; you can redistribute it and/or modify
#   it under the terms of the GNU General Public License as published by
#   the Free Software Foundation; version 2 of the License.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
#    Author:
#          Sebastian Treu
#          sebastian.treu (at) gmail.com
#
#!/bin/bash
sed -n '
'/ESSID/' !{
           '/Cell/' !{
                     d
           }
    '/Cell/'  {
              s/^[ ]*//g
       s/Cell [0-9]\  - Address: /Address=/g
       x
       d
    }
}
'/ESSID/' {
   s/^[ ]*//g
     s/ESSID:\"\(.*\)\"/[\1]/g 
   p
   x
   p
}'
No hay comentarios:
Publicar un comentario