samedi 28 février 2015

How to extract only a part of one line?


I want to extract the essid in a dump file from airodump-ng using grep. The part where I want to extract looks like this:



<SSID first-time="Wed Feb 25 07:06:57 2015" last-time="Wed Feb 25 07:14:23 2015">
<type>Beacon</type>
<max-rate>54.000000</max-rate>
<packets>3371</packets>
<beaconrate>10</beaconrate>
<encryption>WPA2 AES-CCM </encryption>
<essid cloaked="false">WLAN-123651234</essid>
</SSID>
<BSSID>24:65:11:3A:68:02</BSSID>
<manuf>Unknown</manuf>
<channel>1</channel>
<freqmhz>2412 23193</freqmhz>
<maxseenrate>54000</maxseenrate>
<packets>


So I want to extract the essid "WLAN-123651234" in line 7. How do I do this ? And it shouldn't matter how long the essid is because i want to use that way not only for that essid, so it needs to be extracted like this:



grep >....< dumpfile.netxml
Output: WLAN-1234651234


Aucun commentaire:

Enregistrer un commentaire