User Discussions > How To?

Using grep and shell scripts to search highway data, waypoint labels, etc.

<< < (2/5) > >>

yakra:

--- Quote from: neroute2 on November 18, 2019, 08:45:36 am ---It's a numbered county road with Old 50 or Old Hwy 50 in the shield. False positive.

--- End quote ---
Oh wows. I did look for something like that, just not hard enough. :D

rickmastfan67:

--- Quote from: yakra on November 18, 2019, 01:17:40 pm ---
--- Quote from: neroute2 on November 18, 2019, 08:45:36 am ---It's a numbered county road with Old 50 or Old Hwy 50 in the shield. False positive.

--- End quote ---
Oh wows. I did look for something like that, just not hard enough. :D

--- End quote ---

Welcome to the world of insanity in FL.  :P

yakra:
Could that be considered a form of bannered route?  ;D

cvoight:
The closest equivalent native to Windows PowerShell is Select-String, which is decently powerful though no grep. Executing from the hwy_data directory, you use Get-ChildItem -Include "*.wpt" -Recurse to feed all the files into Select-String. Your pattern will always start with ^ if searching waypoint labels as that signifies the start of a line, functioning similarly to the cut -f1 -d " " portion of yakra's commands.

For example, executing the following command finds any waypoint labels that start with US- (i.e. US routes with a hyphen between the US and the route number).


--- Code: ---Get-ChildItem -Include "*.wpt" -Recurse | Select-String -Pattern "^US-"
--- End code ---

Slightly more complicated: find all the waypoints in the US that start with I followed directly by a number. [Note: this is not quite restricted to the US as there are some non-US regions with highway directories that contain the string "usa", but it eliminates most regions and (currently) all false positives. See the code section in this post for a regex that matches only US states and territories.]


--- Code: ---Get-ChildItem -Directory "*usa*" -Recurse | Get-ChildItem -Include "*.wpt" -Recurse | Select-String -Pattern "^I[0-9]"
--- End code ---

cvoight:
Pursuant to a point by neroute2 that I had overlooked:


--- Quote ---FaiRd, PapMillRd
Truncation rules: abbreviate the generic road type (Rd for Road, Blvd for Boulevard, etc.) if it's one of the very common types. Otherwise, use the first three letters: Uli for Ulica. Skip the final period.

For up to two other (specifying) words, truncate the word as follows:
1-4 letters - use whole word
5+ letters - use the first 3 letters. Don't use a made-up abbreviation. Fairchild Road becomes FaiRd, not FrchldRd or FchRd or anything else.
--- End quote ---

First, find all waypoints with a capital letter followed by 4 or more lowercase letters, executed from the hwy_data directory: Get-ChildItem -Include "*.wpt" -Recurse | Select-String -CaseSensitive -Pattern "[A-Z][a-z]{4,}" (In actuality, I piped this to a text file by appending | Out-File .\four_lowercase.txt

Scanning this file, I filter the results: delete many odd results from ITA\ita.nsa (2).wpt; delete Minnesota subway lines (MN\usamnmt\BlueLine.wpt & MN\usamnmt\GreenLine.wpt); all lines that contain a + [presumably waypoint alias] -- using Sublime Text, execute a regex search for ^.*\+.*$, select find all, and press delete twice; results from _boundaries directory. This leaves 151 results of which the vast majority are valid. (Some look like simple miscapitalizations -- e.g. CA\usaca\ca.ca001.wpt:299:Fulst, others are more involved. There are quite a few in preview systems, but still many in active systems.)

region\system\wpt file : line number : result


--- Code: ---AL\usaal\al.al005.wpt:69:PrattHwy http://www.openstreetmap.org/?lat=33.577266&lon=-86.913711
AL\usaal\al.al013.wpt:44:CourtSt http://www.openstreetmap.org/?lat=34.797488&lon=-87.674160
AL\usaal\al.al013.wpt:47:RoyalAve http://www.openstreetmap.org/?lat=34.805329&lon=-87.664483
AL\usaal\al.al017.wpt:115:CourtSt http://www.openstreetmap.org/?lat=34.797488&lon=-87.674160
AL\usaal\al.al017.wpt:118:RoyalAve http://www.openstreetmap.org/?lat=34.805329&lon=-87.664483
AL\usaal\al.al041.wpt:68:WaterAve http://www.openstreetmap.org/?lat=32.412348&lon=-86.995336
AL\usaal\al.al053.wpt:13:TN7Truck http://www.openstreetmap.org/?lat=34.991991&lon=-86.844633
AL\usaus\al.us043.wpt:2:CraftHwy http://www.openstreetmap.org/?lat=30.761632&lon=-88.074029
AL\usaus\al.us043.wpt:12:SteelDr http://www.openstreetmap.org/?lat=31.139821&lon=-88.009876
AL\usaus\al.us043.wpt:58:CedarAve http://www.openstreetmap.org/?lat=32.518402&lon=-87.835168
AL\usaus\al.us043.wpt:150:CourtSt http://www.openstreetmap.org/?lat=34.797488&lon=-87.674160
AL\usaus\al.us043.wpt:153:RoyalAve http://www.openstreetmap.org/?lat=34.805329&lon=-87.664483
AL\usaus\al.us072.wpt:6:HaleyDr http://www.openstreetmap.org/?lat=34.734590&lon=-87.897191
AL\usaus\al.us072.wpt:20:CourtSt http://www.openstreetmap.org/?lat=34.797488&lon=-87.674160
AL\usaus\al.us072.wpt:23:RoyalAv http://www.openstreetmap.org/?lat=34.805329&lon=-87.664483
AL\usaus\al.us072.wpt:40:ClintSt http://www.openstreetmap.org/?lat=34.788594&lon=-86.964217
AL\usaus\al.us072.wpt:51:NanceRd http://www.openstreetmap.org/?lat=34.755622&lon=-86.731852
AL\usaus\al.us072.wpt:65:BrockRd http://www.openstreetmap.org/?lat=34.734947&lon=-86.430259
AL\usaus\al.us078.wpt:38:PrattHwy http://www.openstreetmap.org/?lat=33.577266&lon=-86.913711
AL\usaus\al.us080.wpt:38:WaterAve http://www.openstreetmap.org/?lat=32.412348&lon=-86.995336
AL\usaus\al.us082.wpt:27:CampusDr http://www.openstreetmap.org/?lat=33.212584&lon=-87.525823
AL\usaus\al.us098.wpt:12:I-65Ramps http://www.openstreetmap.org/?lat=30.707093&lon=-88.122593
AL\usaus\al.us231.wpt:168:WinchRd http://www.openstreetmap.org/?lat=34.792814&lon=-86.577448
AL\usaus\al.us278.wpt:42:RidgeRd http://www.openstreetmap.org/?lat=34.193062&lon=-87.194286
AL\usaus\al.us278.wpt:82:CleveAv http://www.openstreetmap.org/?lat=34.019661&lon=-86.086024
AL\usaus\al.us280.wpt:9:CahabaRd http://www.openstreetmap.org/?lat=33.483357&lon=-86.779590
AL\usaus\al.us280.wpt:10:HollyBlvd http://www.openstreetmap.org/?lat=33.482355&lon=-86.778045
AL\usaus\al.us431.wpt:127:EBroadSt http://www.openstreetmap.org/?lat=33.986730&lon=-85.965711
AL\usaus\al.us431.wpt:135:CleveAv http://www.openstreetmap.org/?lat=34.019661&lon=-86.086024
AL\usaus\al.us431.wpt:185:WinchRd http://www.openstreetmap.org/?lat=34.792814&lon=-86.577448
ARG\argrn\arg.rn003.wpt:182:AveoseIng http://www.openstreetmap.org/?lat=-45.824216&lon=-67.466655
BLZ\blzar\blz.ar001.wpt:15:ValofPeaRd http://www.openstreetmap.org/?lat=17.258452&lon=-88.804291
CA\usaca\ca.ca001.wpt:299:Fulst http://www.openstreetmap.org/?lat=37.773133&lon=-122.471791
CA\usaca\ca.ca002.wpt:6:AveStars http://www.openstreetmap.org/?lat=34.061137&lon=-118.418541
CA\usaca\ca.ca029.wpt:5:Tenst http://www.openstreetmap.org/?lat=38.109986&lon=-122.254744
CA\usaush\ca.us066hishol.wpt:10:AveStars http://www.openstreetmap.org/?lat=34.061137&lon=-118.418541
CO\usaus\co.us285.wpt:67:LightLn http://www.openstreetmap.org/?lat=39.530608&lon=-105.305586
COD\afrrtr\cod.rtr05.wpt:206:Kimbi http://www.openstreetmap.org/?lat=-5.141853&lon=19.044714
COD\afrtah\cod.tah10.wpt:206:Kimbi http://www.openstreetmap.org/?lat=-5.141853&lon=19.044714
COD\codn\cod.n001.wpt:191:Kimbi http://www.openstreetmap.org/?lat=-5.141853&lon=19.044714
FL\usaus\fl.us001.wpt:274:LewSpdwy http://www.openstreetmap.org/?lat=29.940358&lon=-81.335014
GA\usaga\ga.ga003.wpt:87:AMSpeed http://www.openstreetmap.org/?lat=33.389291&lon=-84.307837
GA\usaus\ga.us019.wpt:87:AMSpeed http://www.openstreetmap.org/?lat=33.389291&lon=-84.307837
GA\usaus\ga.us041.wpt:134:AMSpeed http://www.openstreetmap.org/?lat=33.389291&lon=-84.307837
IA\usaia\ia.ia028.wpt:2:Prole http://www.openstreetmap.org/?lat=41.409261&lon=-93.726897
IA\usaia\ia.ia148.wpt:3:PearlSt http://www.openstreetmap.org/?lat=40.668872&lon=-94.721396
IA\usaia\ia.ia163.wpt:13:Monroe http://www.openstreetmap.org/?lat=41.544304&lon=-93.130245
IA\usaia\ia.ia163.wpt:17:Otley http://www.openstreetmap.org/?lat=41.464405&lon=-93.038921
ID\usaid\id.id004.wpt:5:Burke http://www.openstreetmap.org/?lat=47.520635&lon=-115.818837
ID\usaid\id.id013buskoo.wpt:2:Brdway_E http://www.openstreetmap.org/?lat=46.145176&lon=-115.971272
ID\usaid\id.id014.wpt:16:Golden http://www.openstreetmap.org/?lat=45.811881&lon=-115.682401
ID\usaid\id.id021.wpt:7:HilndVlySmt http://www.openstreetmap.org/?lat=43.570123&lon=-116.031404
ID\usaid\id.id022.wpt:12:SmallCO http://www.openstreetmap.org/?lat=44.172718&lon=-112.418217
ID\usaid\id.id051.wpt:14:Blkstn http://www.openstreetmap.org/?lat=42.440221&lon=-115.887000
IRL\eurtr\irl.waw.wpt:64:Veagh http://www.openstreetmap.org/?lat=54.974363&lon=-7.578678
ISL\islth\isl.th001.wpt:105:ThverDal http://www.openstreetmap.org/?lat=65.524878&lon=-19.797192
ISL\islth\isl.th083.wpt:14:AegisSid http://www.openstreetmap.org/?lat=65.946612&lon=-18.185484
ISL\islth\isl.th326.wpt:3:Haell http://www.openstreetmap.org/?lat=64.063079&lon=-20.238147
ISL\islth\isl.th413.wpt:8:ThingTor http://www.openstreetmap.org/?lat=64.101128&lon=-21.780245
ISL\islth\isl.th635.wpt:2:Arsel http://www.openstreetmap.org/?lat=65.892119&lon=-22.307868
ISL\islth\isl.th643.wpt:50:Arnes http://www.openstreetmap.org/?lat=66.011236&lon=-21.510061
ISL\islth\isl.th645.wpt:16:Bakki http://www.openstreetmap.org/?lat=65.776642&lon=-21.520329
LA\usala\la.la0428.wpt:3:GendeGDr_E http://www.openstreetmap.org/?lat=29.922734&lon=-90.017268
LA\usala\la.la0454.wpt:3:ABPorterRd http://www.openstreetmap.org/?lat=31.189230&lon=-92.248641
LA\usala\la.la0608.wpt:6:DavisLdg http://www.openstreetmap.org/?lat=32.036520&lon=-91.136130
LA\usala\la.la1168.wpt:3:BoisdArcRd http://www.openstreetmap.org/?lat=30.656146&lon=-92.228916
MEX-BC\mexd\mexbc.mex002d.wpt:2:BlvrJosexPon http://www.openstreetmap.org/?lat=32.536697&lon=-116.930344
MEX-DF\mexsf\mexdf.aniper.wpt:44:AveConst http://www.openstreetmap.org/?lat=19.410897&lon=-99.193870
MEX-DF\mexsf\mexdf.aniper.wpt:54:AveConsc http://www.openstreetmap.org/?lat=19.444180&lon=-99.218023
MEX-DF\mexsf\mexdf.auturbnte.wpt:3:AveConst http://www.openstreetmap.org/?lat=19.410897&lon=-99.193870
MEX-DF\mexsf\mexdf.auturbnte.wpt:8:AveConsc http://www.openstreetmap.org/?lat=19.444180&lon=-99.218023
MEX-YUC\mexsf\mexyuc.yuc01.wpt:24:Chenku http://www.openstreetmap.org/?lat=21.018874&lon=-89.661055
MO\usai\mo.i064.wpt:28:FortyDr http://www.openstreetmap.org/?lat=38.631539&lon=-90.378728
MO\usamo\mo.mo001.wpt:5:ChoTrfwy http://www.openstreetmap.org/?lat=39.193940&lon=-94.548683
MO\usamo\mo.mo125.wpt:9:GladTopTrail http://www.openstreetmap.org/?lat=36.660123&lon=-92.851810
MO\usamo\mo.mo269.wpt:1:FrontSt http://www.openstreetmap.org/?lat=39.130816&lon=-94.522848
MO\usaus\mo.us040.wpt:126:FortyDr http://www.openstreetmap.org/?lat=38.631539&lon=-90.378728
MP\usamp\mp.mp101.wpt:6:Isang http://www.openstreetmap.org/?lat=14.149185&lon=145.162826
MS\usaus\ms.us045.wpt:45:Lauder http://www.openstreetmap.org/?lat=32.519754&lon=-88.517261
MS\usaus\ms.us049e.wpt:26:Sidon http://www.openstreetmap.org/?lat=33.408159&lon=-90.204127
MS\usaus\ms.us051.wpt:87:I55Front http://www.openstreetmap.org/?lat=32.405110&lon=-90.145912
MS\usaus\ms.us051.wpt:98:UnionSt http://www.openstreetmap.org/?lat=32.599397&lon=-90.035834
MS\usaus\ms.us051.wpt:163:PearlSt http://www.openstreetmap.org/?lat=33.786370&lon=-89.809906
MS\usaus\ms.us051.wpt:182:HentzRd http://www.openstreetmap.org/?lat=34.225748&lon=-89.939361
MS\usaus\ms.us061.wpt:7:SligoSt http://www.openstreetmap.org/?lat=31.084565&lon=-91.304219
MS\usaus\ms.us061.wpt:22:SmithRd http://www.openstreetmap.org/?lat=31.304112&lon=-91.358829
MS\usaus\ms.us061.wpt:94:BowieRd http://www.openstreetmap.org/?lat=32.386739&lon=-90.827322
MS\usaus\ms.us061.wpt:111:KelsoRd http://www.openstreetmap.org/?lat=32.633701&lon=-90.863714
MS\usaus\ms.us061.wpt:113:DixieRd http://www.openstreetmap.org/?lat=32.654190&lon=-90.869765
MS\usaus\ms.us061.wpt:115:OmegaRd http://www.openstreetmap.org/?lat=32.669943&lon=-90.879121
MS\usaus\ms.us061.wpt:122:MooreRd http://www.openstreetmap.org/?lat=32.778327&lon=-90.933881
MS\usaus\ms.us061.wpt:153:HeadsRd http://www.openstreetmap.org/?lat=33.470507&lon=-90.846505
MS\usaus\ms.us061.wpt:170:MoodyRd http://www.openstreetmap.org/?lat=33.908783&lon=-90.742393
MS\usaus\ms.us072.wpt:41:SalemRd http://www.openstreetmap.org/?lat=34.909021&lon=-88.491526
MS\usaus\ms.us080.wpt:43:GuldeRd http://www.openstreetmap.org/?lat=32.294026&lon=-89.876533
MS\usaus\ms.us080.wpt:82:AdamsSt http://www.openstreetmap.org/?lat=32.326161&lon=-88.931065
MS\usaus\ms.us084.wpt:2:CanalSt http://www.openstreetmap.org/?lat=31.552062&lon=-91.412044
MS\usaus\ms.us084.wpt:20:Roxie http://www.openstreetmap.org/?lat=31.507435&lon=-91.064987
MS\usaus\ms.us084.wpt:22:KirbyRd http://www.openstreetmap.org/?lat=31.495177&lon=-91.013274
MS\usaus\ms.us084.wpt:107:MaxeyRd http://www.openstreetmap.org/?lat=31.695492&lon=-89.214649
MS\usaus\ms.us084.wpt:109:FlyntRd http://www.openstreetmap.org/?lat=31.694178&lon=-89.185038
MS\usaus\ms.us278.wpt:11:HeadsRd http://www.openstreetmap.org/?lat=33.470507&lon=-90.846505
MS\usaus\ms.us278.wpt:28:MoodyRd http://www.openstreetmap.org/?lat=33.908783&lon=-90.742393
MS\usaus\ms.us278.wpt:135:WolfeRd http://www.openstreetmap.org/?lat=33.883225&lon=-88.274760
MS\usaus\ms.us425.wpt:3:CanalSt http://www.openstreetmap.org/?lat=31.552062&lon=-91.412044
MS\usausb\ms.us051sprjac.wpt:7:EndMaint http://www.openstreetmap.org/?lat=32.285273&lon=-90.183120
MT\usausb\mt.us093busmis.wpt:3:MountAve http://www.openstreetmap.org/?lat=46.855936&lon=-114.013120
MT\usausb\mt.us093busmis.wpt:5:RiverSt http://www.openstreetmap.org/?lat=46.869683&lon=-114.003443
NC\usanc\nc.nc126.wpt:4:LakeJamesStaPk http://www.openstreetmap.org/?lat=35.728239&lon=-81.901703
NC\usaus\nc.us064.wpt:142:SpeMtnrd http://www.openstreetmap.org/?lat=35.716768&lon=-79.910329
NC\usaus\nc.us176.wpt:4:SlakeSumRd http://www.openstreetmap.org/?lat=35.233669&lon=-82.391018
NLD\nlda\nld.a325.wpt:2:Elden http://www.openstreetmap.org/?lat=51.958363&lon=5.888801
NLD\nlda\nld.a325.wpt:3:BurgMatsl http://www.openstreetmap.org/?lat=51.950772&lon=5.878973
NM\usaus\nm.us054.wpt:25:Polly http://www.openstreetmap.org/?lat=33.570846&lon=-105.981481
ON\cannf\on.rr174.wpt:3:Traway http://www.openstreetmap.org/?lat=45.435736&lon=-75.598018
OR\usaor\or.or003.wpt:15:FloraLn http://www.openstreetmap.org/?lat=45.891054&lon=-117.262316
OR\usaor\or.or018buswil.wpt:3:Mainst http://www.openstreetmap.org/?lat=45.078445&lon=-123.486414
OR\usaor\or.or034.wpt:82:Colst http://www.openstreetmap.org/?lat=44.555846&lon=-123.079598
OR\usaor\or.or099.wpt:163:SixthAve http://www.openstreetmap.org/?lat=43.395140&lon=-123.314978
OR\usaor\or.or099.wpt:234:Brdwy http://www.openstreetmap.org/?lat=44.049927&lon=-123.086561
OR\usaor\or.or126busspr.wpt:3:Brdwy http://www.openstreetmap.org/?lat=44.049927&lon=-123.086561
OR\usaor\or.or138.wpt:64:CleFalls http://www.openstreetmap.org/?lat=43.247891&lon=-122.233865
OR\usaor\or.or173.wpt:11:TimLodge http://www.openstreetmap.org/?lat=45.330555&lon=-121.709290
OR\usaor\or.or219.wpt:17:NorthSt http://www.openstreetmap.org/?lat=45.304369&lon=-122.972760
OR\usaor\or.or223.wpt:4:MaxcreRd http://www.openstreetmap.org/?lat=44.695048&lon=-123.432212
OR\usaor\or.or238.wpt:16:Mainst http://www.openstreetmap.org/?lat=42.325412&lon=-122.943449
OR\usaor\or.or281.wpt:4:ClearCreRd http://www.openstreetmap.org/?lat=45.519564&lon=-121.596680
OR\usaor\or.or551.wpt:3:NEArdntRd http://www.openstreetmap.org/?lat=45.259603&lon=-122.769470
OR\usaush\or.us030hiscol.wpt:6:StarkSt http://www.openstreetmap.org/?lat=45.515610&lon=-122.361689
PR\usapr\pr.pr0003.wpt:83:CllLMRivera_E http://www.openstreetmap.org/?lat=18.007422&lon=-65.899344
QC\canqc\qc.qc198.wpt:12:AvMiller http://www.openstreetmap.org/?lat=48.951245&lon=-65.494206
ROU\roudj\rou.dj682e.wpt:3:Igrfry http://www.openstreetmap.org/?lat=46.123455&lon=20.786380
SCT\eurtr\sct.fifcoatr.wpt:50:BackStile http://www.openstreetmap.org/?lat=56.297586&lon=-2.658691
SD\usasd\sd.sd053.wpt:10:Mosher http://www.openstreetmap.org/?lat=43.474894&lon=-100.294061
SD\usasd\sd.sd471.wpt:2:Rumford http://www.openstreetmap.org/?lat=43.131025&lon=-103.700895
SD\usasd\sd.sd471.wpt:7:Provo http://www.openstreetmap.org/?lat=43.192255&lon=-103.833761
SD\usaus\sd.us016.wpt:11:AveofChiefs http://www.openstreetmap.org/?lat=43.820316&lon=-103.640041
SD\usaus\sd.us385.wpt:29:AveofChiefs http://www.openstreetmap.org/?lat=43.820316&lon=-103.640041
SD\usausb\sd.us014altdea.wpt:4:Savoy http://www.openstreetmap.org/?lat=44.352716&lon=-103.931608
SK\cansk\sk.sk010.wpt:33:Barvas http://www.openstreetmap.org/?lat=51.210211&lon=-102.099724
UT\usausb\ut.us191bushel.wpt:2:PopSt PoplarSt http://www.openstreetmap.org/?lat=39.682635&lon=-110.854765 [should this have a + before PoplarSt? it appears correctly in Highway Browser.]
UT\usausb\ut.us191bushel.wpt:3:JanSt JanetSt http://www.openstreetmap.org/?lat=39.688473&lon=-110.854679 [should this have a + before JanetSt? it appears correctly in Highway Browser.]
UT\usaut\ut.ut024.wpt:137:OldStateHwy http://www.openstreetmap.org/?lat=38.873870&lon=-110.359243
UT\usaut\ut.ut257.wpt:11:Bloom http://www.openstreetmap.org/?lat=38.937581&lon=-112.808647
VA\usaus\va.us050.wpt:50:QueenSt http://www.openstreetmap.org/?lat=38.889655&lon=-77.077965
WI\usaus\wi.us010.wpt:159:Ferry http://www.openstreetmap.org/?lat=44.090020&lon=-87.650449
WI\usausb\wi.us041altosh.wpt:7:SnellRd http://www.openstreetmap.org/?lat=44.068409&lon=-88.543153
WI\usawi\wi.wi080.wpt:64:Sprague http://www.openstreetmap.org/?lat=44.147633&lon=-90.131750
WI\usawi\wi.wi169.wpt:8:Gurney http://www.openstreetmap.org/?lat=46.470734&lon=-90.508289
WI\usawi\wi.wi175.wpt:7:LloydSt http://www.openstreetmap.org/?lat=43.054684&lon=-87.971778
ZWE\zwep\zwe.p011.wpt:22:Gokwe http://www.openstreetmap.org/?lat=-18.217632&lon=28.942280
--- End code ---

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version