Pulling data by GPS coordinates from text file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Pulling data by GPS coordinates from text file
# 1  
Old 03-10-2011
Question Pulling data by GPS coordinates from text file

Hi there,
I'm having a problem trying to extract data from within a text file. I'm trying to extract this manually for a lack of better words.
I need any items that fall within latitude 36.5 to 39.5 and long -75.3 to -83.9

I have been doing this using cat neta.txt | grep '!38' and working this slowly. I know there is an easier way. I'm drawing a blank.

Thanks you in advance for any help.

Mike



Here is an example from the text file.
Code:
KB0JBF-3>APN382,qAS,KB0JBF:!4229.36NL09332.63W#PHG6130/R,IAN,WIDEN 444.500 PL151.4 WILLIAMS,IA
LD4ST>APNU19,qAR,LA6JF-2:!5902.71NS00559.07E#PHG3500 STRAND W3,NORn
KA0GFC-3>APW284,TCPIP*,qAC,FIRST:=3856.83NS09244.75W#PHG9250/KA0GFC BOONVILLE ECHOLINK#239712 -MOBOOCOLUMBIA-284-<630>
W4LJM>APN383,KF4OWQ-2*,WIDE3-2,qAR,KF4REN:!3729.00NS08541.48W#PGH7450 W2, Kyn-N Digi in Buffalo, Ky.
VE7RKA>APN382,qAR,VE7RXD-9:!5036.65NS12038.00W#PHG4840/W2,BCn,Greenstone Mtn VE7FSR
KD8KSN-1>APN391,K8QIK-5*,WIDE1,WIDE2-2,qAR,K8PJ-1:!4009.87N/08229.17W#PHG5370/W3,OHn-n kd8ksn@amsat.org
I0TVL-11>APNU19,WIDE3-2,qAR,IR0UFQ-2:!4153.07N/01228.98E#PHG3160/DIGI APRS I0TVL -Roma Centro- Sito di I0TVL Giuseppe
NR6G-3>APN391,qAR,NR6G-1:!3620.90NS12036.03W#PHG3930 WIDEn-N, NCAn-N Weather Station Digi on Santa Rita PK
KF4OWQ-2>APN391,WIDE2-2,qAR,KF4REN:!3709.02N/08359.28W# LONDON KY
F6DBP-3>APFD33,F6KLI-4,WIDE1*,WIDE3-3,qAR,F6KLI-15:@000000h4457.06N/00018.66W#PHG3560 Digi solaire en test 
S55YZA-11>APNU19,WIDE3-3,qAo,S56UBS-11:!4611.22N/01506.45E#PHG3030/(2: S55YZA INFO:s57c@hamradio.si)
K9ABC-1>APN383,qAR,W9RCG-1:!4304.39NS08823.26W#PHG7760/W3,WIn Welcome to the Frontpage
SR4NWH>APU25N,TCPIP*,qAC,T2POLAND:=5310.36NS02202.34E#PHG3370 Lomza IGATE henpor@interia.pl
KB2JOE-15>APU25N,TCPIP*,qAC,T2MSSOURI:=4051.47N/07311.49W#SMITHTOWN ARES DIV4
F4FXL-3>APRX22,WIDE2-2,qAR,DB0MOE:!4849.51N100736.42E#Digi Val de Moder, serving the community since 2010
XE1SDK>APN382,WIDE2-1,qAR,XE1KK:!1903.56NF09810.44W#PHG22304/DIGI EN PUEBLA, GRID EK09
ZL2BAU>APX200,TCPIP*,qAC,T2NZAA:;GOR      *101829z4602.24SP16851.36E# ZL4AL-1 TheNet2.08 Netrom Digi 144.650 MHz
K1LH-3>APN391,WIDE2-1,qAR,KG4MFJ-1:!3604.92NS08522.45W#PHG5450/ Serving the Upper Cumberland.
KC0MWM-1>APOT2A,WIDE2-2,qAR,N0YXV-1:!4055.45NS09820.35W#PHG8330   EOC Digi
LD4SJ>APNU19,qAS,LA4JAA:!5852.08NS00540.80E#PHG3230 SANDNES   W3,NORn
VE3KCR>APN383,qAo,SFLDV:!4226.14NS08206.23W#PHG7640/W2,SONTn,Chatham - ve3cih@rac.ca
AA8KY-10>APNU19,WIDE3-3,qAS,AA8KY:!3844.13NS08300.00W# W3 OHn Portsmouth, OH
LAMAR>APN382,qAR,KC0HH:!3802.22NS10235.97W#PHG5550 W2, COn-N, KC0HH LAMAR,CO
CT1FNE-3>APNU3B,CQ0XCM-3,CT0XOD-3*,qAR,CT1EJC-3,PORTUGAL:!3832.05NS00852.73W#PHG3330 W3,PRTn Setubal
KI4WEF>APN391,K4KJQ-10,WIDE1*,WIDE2-1,qAo,KD4SN:!3831.35N108434.13W#PHG5030/W1,KY1 FILL-IN DIGI
WB0HAC>APN391,qAR,K0SUN-10:!3859.33NS09450.66W#PHG5591/W3 KCMOn SRACT in Shawnee KS wb0hac@kc.rr.com
IK8TGH-11>APNU19,qAR,IW8RBI-1:!3812.71N/01538.29E# (DIGI Villa San Giovanni JM78TF)
J41VAF>APZ186,J41VAI*,qAR,SV1UY-10:!3802.99N/02352.17E#PHG4880/  grcNet  * S.R.E. *DataGroup* 
KV3B-2>APN383,qAR,K7BC:!3857.05NS07652.41W#PHG5560 Montgomery ARC
KC0IRJ-3>APN383,qAR,KB0PJH:!3833.12NL09212.79W#PHG5320 KC0IRJ-3 W3,MOn
IW8QPG-11>APZ186,TRACE7-7,qAR,IT9ITT:!3812.43N/01545.14E#PHG5460/IK8TGH Email antoniotgh@alice.it
KA0GFC-4>APN391,qAS,KA0GFC-3:!3815.21N109155.76W#PHG7250 W1,MOn 443.700 77.0 FREEBURG, MO
IQ8LD>APNU19,IR8AM,IW9CRG-11*,qAR,IT9ITT:!3822.12N/01624.04E# (A.R.I.Locride prov.Reggio Cal.APRS) 1
IR9BB>APNU19,WIDE,qAR,IW8RBI-1:!3808.13N/01529.12E# (Cisar MESSINA)
KC4WCG-3>APN382,qAR,K0SUN-10:!3846.91NS09445.63W# W3 KSn-N SUNROSES kc4wcg@hotmail.com
ZL1BCO-3>APNU3B,WIDE1-1,qAR,ZL1SY-1:!3831.11S/17601.29E#PHG4852 UIDIGI V1.9, b3 - Mt. Maroanui - Taupo
KI4WEF>APN391,K4KJQ-10,WIDE1*,WIDE2-1,qAo,KD4SN:!3831.35N108434.13W#PHG5030/W1,KY1 FILL-IN DIGI
CU3URA-1>APOT21,WIDE1-1,WIDE2-2,qAR,CU3CO,PORTUGAL:!3843.80N/02719.07W#13.6V  13C *DIGI*CU3URA*STA BARBARA*TERCEIRA*AZORES ISL.*


Last edited by joeyg; 03-10-2011 at 03:16 PM.. Reason: CodeTags please around scripts and data
# 2  
Old 03-10-2011
Question

Please explain a sample line -
Code:
KB0JBF-3>APN382,qAS,KB0JBF:!4229.36NL09332.63W#PHG6130/R,IAN,WIDEN 444.500 PL151.4 WILLIAMS,IA

I see
4229.36N
09332.63W
# 3  
Old 03-10-2011
Question explainned

Quote:
Originally Posted by joeyg
Please explain a sample line -
Code:
KB0JBF-3>APN382,qAS,KB0JBF:!4229.36NL09332.63W#PHG6130/R,IAN,WIDEN 444.500 PL151.4 WILLIAMS,IA

I see
4229.36N
09332.63W
Yes you are correct ! beginning marker
4229.36N is the lat 42 29.36N
L ignore this space
09332.63W is the lon 093 32.63W
# 4  
Old 03-10-2011
Clarifications?

In your text you said you were grabbing for !38
But, not all lines (like 3rd) does not follow that logic.

See following:
Code:
$ awk -F'!' '{long=substr($2,1,4); lat=substr($2,10,5); print long"--"lat}' <sample2.txt
4229--09332
5902--00559
--
3729--08541
5036--12038
4009--08229
4153--01228
3620--12036
3709--08359
--
4611--01506

I copied first several lines of your file to experiment with. But a couple lines do not follow pattern.
# 5  
Old 03-10-2011
The example was yes a grep of !38 Then I did a grep of !39 and so fourth. Every time I update the file I have to re run my sequence all over again.

Quote:
Originally Posted by joeyg
In your text you said you were grabbing for !38
But, not all lines (like 3rd) does not follow that logic.

See following:
Code:
$ awk -F'!' '{long=substr($2,1,4); lat=substr($2,10,5); print long"--"lat}' <sample2.txt
4229--09332
5902--00559
--
3729--08541
5036--12038
4009--08229
4153--01228
3620--12036
3709--08359
--
4611--01506

I copied first several lines of your file to experiment with. But a couple lines do not follow pattern.
# 6  
Old 03-10-2011
What about your 3rd line?
Code:
grep '!38'

will not capture, but would appear to be valid.

Lines like 3rd and 10th are to be ignored?
# 7  
Old 03-10-2011
Question

Quote:
Originally Posted by joeyg
What about your 3rd line?
Code:
grep '!38'

will not capture, but would appear to be valid.

Lines like 3rd and 10th are to be ignored?
I will have to go back and visit those items. I was looking through the database and found these preceding the coords :
! and = anything else appears to be bad data because of poor data entry at the end point. I'm not interested in that.

---------- Post updated at 05:21 PM ---------- Previous update was at 04:08 PM ----------

<code>
awk -F'!' '{lat=substr($2,1,2); lon=substr($2,10,3); (lat >36 && lat <39) && (lon > -75 && lon < -84) print lat"--"lon}' < net.log
</code>
The above code is what I have tried without success.

The only two valid items ahead of the lat is either ! or = nothing else.

Quote:
Originally Posted by Mikey
I will have to go back and visit those items. I was looking through the database and found these preceding the coords :
! and = anything else appears to be bad data because of poor data entry at the end point. I'm not interested in that.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Pulling information from a data file by date

awk -v now="$(date +%s)" -v tDiff="${USERMINUTES}" ' BEGIN { FS="=" if (!now) now=systime() if (!tDiff) tDiff=60*60 p=1 } /{/ {rec=$0;p=1;next} /}/ && rec && p {print rec ORS $0;next} $1=="entry_time" { if (now-$2>tDiff)p=0 } {rec=rec ORS $0}'... (6 Replies)
Discussion started by: SkySmart
6 Replies

2. Shell Programming and Scripting

Pulling Data, Then Moving to the Next File

I'm scanning a list of emails- I need to pull 2 pieces of data, then move to the next file: Sender's Email Address Email Date I need these to be outputted into a single column- separated by a ",". Like this: Email1's Address, Email1's Date Stamp Email2's Address, Email2's Date Stamp... (4 Replies)
Discussion started by: sudo
4 Replies

3. Shell Programming and Scripting

Reducing the decimal points of numbers (3d coordinates) in a file; how to input data to e.g. Python

I have a file full of coordinates of the form: 37.68899917602539 58.07500076293945 57.79100036621094 The numbers don't always have the same number of decimal points. I need to reduce the decimal points of all the numbers (there are 128 rows of 3 numbers) to 2. I have tried to do this... (2 Replies)
Discussion started by: crunchgargoyle
2 Replies

4. Shell Programming and Scripting

BASH- Need help pulling data from .emlx

Hello, fellow computer junkies. First time poster! My boss wrote an application (Mavericks 10.9, Mountain Lion 10.8) that checks a user's security settings. The user runs the application, then it spits out an email that is sent back to our inbox showing the results. On our end, we have a mail rule... (5 Replies)
Discussion started by: sudo
5 Replies

5. Shell Programming and Scripting

Pulling data from xml

Hi there, Please could anyone help with this. I have an xml file that contains repeating values eg <Rule name> AAAAA <Action> BBBBB </Action> <Data> CCCCC </Data> <Type> DDDDD </Type> </Rule name> <Rule name> A1A1A1A1 <Action> B1B1B1B1 </Action> <Data> C1C1C1C </Data> <Type>... (4 Replies)
Discussion started by: ssideel
4 Replies

6. Shell Programming and Scripting

SFTP to server, pulling data and removing the data

Hi all, I have the following script, but are not too sure about the syntax to complete the script. In essence, the script must connect to a SFTP server at a client site with username and password located in a file on my server. Then change to the appropriate directory. Pull the data to the... (1 Reply)
Discussion started by: codenjanod
1 Replies

7. Shell Programming and Scripting

Writing a program to receive the GPS data and send to other server

Hi, I would like to write a program to receive the GPS data and then send the data via network to other program. All of the program is not write yet(include host and sender) All of the server OS is unix or linux Could you mind to give me some idea to do this? Thanks so much! Ken ... (2 Replies)
Discussion started by: kenlok
2 Replies

8. Shell Programming and Scripting

shell script to insert data from gps.txt to mysql database

Hi, I have gps receiver, by using gpsd data i can read gps log data to my database(my sql). Steps: 1. telenet localhost 2947 > gps.txt (press enter) 2. r (press enter) //then i will get the data like below in gps.txt file Trying 127.0.0.1... Connected to localhost.... (1 Reply)
Discussion started by: gudivada213
1 Replies

9. Shell Programming and Scripting

Pulling data and following lines from file

I saw a few posts close to what i want to do, but they didn't look like they would work exactly.. or I need to think out of the box on this. I have a file that I keep server stats in for my own performance analysis. this file has the output from many commands in it (uptime, vmstats, ps, swap... (2 Replies)
Discussion started by: MizzGail
2 Replies
Login or Register to Ask a Question