Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Help extracting MAC addresses from List Post 302161271 by dhs23 on Thursday 24th of January 2008 05:48:41 AM
Old 01-24-2008
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
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Mac addresses of NICs (why are they the same)

I am training to be support on our solaris based network and was wondering why solaris seems to assign the same mac address to all NICs placed in the machine regardless of how many NICs are in there, when i do a ifconfig -a all nics have same MAC. Presumably this is a feature and there is... (1 Reply)
Discussion started by: hcclnoodles
1 Replies

2. UNIX Desktop Questions & Answers

Using Mailx to send to list of email addresses

Im trying to use a shell script to send to a list of email addresses in a txt file. Here is what i have tried but it keeps sending to dead.letter... Success.ksh contains... mailx -s"Night Batch Success" 'cat /Scripts/email_addresses.txt' < /Scripts/email_body_message.txt The email body... (1 Reply)
Discussion started by: aguad3
1 Replies

3. Shell Programming and Scripting

Need help with IP and MAC addresses

Hi, i am working on a project where i have to write a script to find out MAC addresses of the systems with given IP address. Can anybody tell me which command i can use to find MAC address if you know IP address of the machine. Thanks (5 Replies)
Discussion started by: manmeet
5 Replies

4. Shell Programming and Scripting

Extracting email addresses from a flat file

All, I have a flat file which contains an email address in every line. I am trying to find a way to extract all the email addresses delimited by comma (,). Can you please show me a way, it will be very helpful, thanks. (3 Replies)
Discussion started by: sed_beginner19
3 Replies

5. UNIX for Dummies Questions & Answers

analyzing list with street addresses

Hi List, Could someone please point me into the right direction with the following: I have a file containing a list of street addresses. I need to sort all the street addresses with the same number to a new file containing the street name and corresponding number. So: Strawinskylaan... (3 Replies)
Discussion started by: M474746
3 Replies

6. UNIX for Dummies Questions & Answers

Difference between Mac and IP addresses

If a web search is done on this topic there are many links but no information included in the documents. So my questions are; Why does a NIC card have it's own permanent ID. Why can't it share the host name? An ID is an ID. Why does a computer need two ways to ID it. If the network... (3 Replies)
Discussion started by: theKbStockpiler
3 Replies

7. Shell Programming and Scripting

Formatting list of IP addresses into a grep command

Hi I have an input file with a list of random IP addresses, each on a new line. Below is just an example as I omitted the real IP addresses for obvious reasons. Input: random_ip.txt 10.0.0.1 10.0.0.1 10.0.0.1 10.0.0.1 10.0.0.1 10.0.0.1 10.0.0.1 10.0.0.1 10.0.0.1 10.0.0.1... (7 Replies)
Discussion started by: lewk
7 Replies

8. UNIX for Dummies Questions & Answers

List Contacted Web Addresses?

Greetings. I'm in the process of tracking down an issue with Firefox, and need some way of gathering the actual web addresses which are connected to from localhost. The specific problem centers around the determination/capture of the exact generated app.update.url address formed by the... (2 Replies)
Discussion started by: LinQ
2 Replies

9. Shell Programming and Scripting

Don't see my mac addresses of my devices

I have a problem with a script , i want to see my devices there are up in my network. I want as output the ip addresses of the devices and also the mac address but I only had the ip addresses #!/bin/bash while ] do -mac) Extension=5 shift mac=$1 shift ;; esac... (1 Reply)
Discussion started by: Roggy
1 Replies

10. Shell Programming and Scripting

Script getting IP's and MAC addresses

Hy over there, Lets make it simple :) Using a bash script, how to grep only the ip address and the mac address and put them in a file:. for example from the dhcp.conf file we got such things: The script will end up with two columns IP's and MAC adresses as it is showed below: ... (9 Replies)
Discussion started by: hermouche
9 Replies
IWEVENT(8)                                                   Linux Programmer's Manual                                                  IWEVENT(8)

NAME
iwevent - Display Wireless Events generated by drivers and setting changes SYNOPSIS
iwevent DESCRIPTION
iwevent displays Wireless Events received through the RTNetlink socket. Each line displays the specific Wireless Event which describes what has happened on the specified wireless interface. This command doesn't take any arguments. DISPLAY
There are two classes of Wireless Events. The first class is events related to a change of wireless settings on the interface (typically done through iwconfig or a script calling iwconfig). Only settings that could result in a disruption of connectivity are reported. The events currently reported are changing one of the following setting : Network ID ESSID Frequency Mode Encryption All those events will be generated on all wireless interfaces by the kernel wireless subsystem (but only if the driver has been converted to the new driver API). The second class of events are events generated by the hardware, when something happens or a task has been finished. Those events include : New Access Point/Cell address The interface has joined a new Access Point or Ad-Hoc Cell, or lost its association with it. This is the same address that is reported by iwconfig. Scan request completed A scanning request has been completed, results of the scan are available (see iwlist). Tx packet dropped A packet directed at this address has been dropped because the interface believes this node doesn't answer anymore (usually maximum of MAC level retry exceeded). This is usually an early indication that the node may have left the cell or gone out of range, but it may be due to fading or excessive contention. Custom driver event Event specific to the driver. Please check the driver documentation. Registered node The interface has successfully registered a new wireless client/peer. Will be generated mostly when the interface acts as an Access Point (mode Master). Expired node The registration of the client/peer on this interface has expired. Will be generated mostly when the interface acts as an Access Point (mode Master). Spy threshold crossed The signal strength for one of the addresses in the spy list went under the low threshold or went above the high threshold. Most wireless drivers generate only a subset of those events, not all of them, the exact list depends on the specific hardware/driver com- bination. Please refer to driver documentation for details on when they are generated, and use iwlist(8) to check what the driver supports. AUTHOR
Jean Tourrilhes - jt@hpl.hp.com SEE ALSO
iwconfig(8), iwlist(8), iwspy(8), iwpriv(8), wireless(7). net-tools 23 June 2004 IWEVENT(8)
All times are GMT -4. The time now is 07:03 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy