The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM



View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 01-24-2008
dhs23 dhs23 is offline
Registered User
 

Join Date: Jan 2008
Posts: 7
Help extracting MAC addresses from List

Hello all.

I have a large number of text files outputted from various Netstumbler Wireless Scans; from which I need to extract the MAC addresses of the various Access Points.

The Text files look like this:

Code:
# $Creator: Network Stumbler Version 0.4.0
# $Format: wi-scan summary with extensions
# Latitude	Longitude	( SSID )	Type	( BSSID )	Time (GMT)	[ SNR Sig Noise ]	# ( Name )	Flags	Channelbits	BcnIntvl	DataRate	LastChannel
# $DateGMT: 2008-01-16
N 0.0000000	E 0.0000000	( belkin54g )	BSS	( 00:11:50:d7:c7:3c )	16:44:39 (GMT)	[ 19 68 49 ]	# (  )	0411	00000800	100	540	11
N 0.0000000	E 0.0000000	( BUFVC Wireless )	BSS	( 00:03:93:ec:21:93 )	16:44:39 (GMT)	[ 33 82 49 ]	# (  )	0411	00000080	100	540	7
N 0.0000000	E 0.0000000	( F-Wireless Zone )	BSS	( 00:19:e8:d8:c2:e0 )	16:44:39 (GMT)	[ 24 73 49 ]	# (  )	0421	00002000	100	540	13
What I would like to do is extract the MAC addresses into another text file so that it ends up looking like this:

FINAL TEXT FILE
Code:
00.11.50.d7.c7.3c
00.03.93.ec.21.93
00.19.e8.d8.c2.e0
I'm pretty new at this whole scripting thing, but I've managed to work our a couple of steps of this process.

1) I can use grep 'N 0.0' to get just the lines with MAC addresses

2) I can probably use tr -d to delete the () around the MAC addresses

What I'm failing to be able to do is basically everything else

1) how do I get just the MAC addresses out of that long line?
2) how do I swap the ":" separating the parts of the MAC addresses for "." ?

I realise this is probably fairly straight forward, and I've tried looking in the various man pages for the likes of awk, sed and grep, but to be honest they are a little confusing.

Any help getting my Wireless Scan text file to look like my hoped for Final text file would be greatly appreciated!

Cheers
Reply With Quote
Remove advertisements
!!
Forum Sponsor