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 -->
  #7 (permalink)  
Old 01-29-2008
dhs23 dhs23 is offline
Registered User
 

Join Date: Jan 2008
Posts: 7
Interesting. I really like that way of doing it actually. And as you say, could be useful if NetStumbler changes their output format.

If anyone is interested, here is the finished script.
Code:
#!/bin/sh

# This script combines the Netstumbler wireless reports and trims and formats them for the monthly report.
# It needs to be run from the directory in which the text files are stored.
# There should NOT be any other files in the directory, and they should all have the file extension .txt

# Combines the files into one

cat *.txt > all0.txt

# Trims out only relevant lines

grep 'N 0.0' all0.txt > all1.txt

# Trims out the rubbish, and outputs the MACS only

awk -F'[()]' 'NR {print $4}' all1.txt > all2.txt

# Substitutes "." for ":" as the MAC address separators

sed -e 's/:/./g' all2.txt > MAC_addresses_from_wireless_scan.txt

# Removes the leftover text files.

rm all0.txt
rm all1.txt
rm all2.txt
I'm sure there is a neater way to do it, without the intermediate files, but as I'm fairly new at this scripting, and just wanted the job done, I went with the way I was sure I could do it.

Comments welcome.
Reply With Quote