Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Update code files in /usr/share/misc' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Update code files in /usr/share/misc
Authored by: MaxMouseroom on Aug 11, '03 02:43:17AM
I was bored and feeling really geeky, so I found a web site with more complete (and International) airport codes, and then wrote a one-liner to convert the web page into the correct format for /usr/share/misc/airport. In case anyone cares, here it is. I wrote it to all go on one (long) line.
sudo curl -s http://www.mapping.com/airportcodes.html | \
awk '/A00/,/9Z9/' | perl -ne '$/=";"; s#  ?##g; s#\n##g; \
s#.*$##i; s###g; s#^\s+##; s#^\s*$##; \
s#\s+#:#; print "$_\n"' > /usr/share/misc/airport

Of course you might want to backup your old file first, etc.

Warning: this file is over 21K lines, compared to 1.9K for the file at the BSD site, and only 153 for the original OS X version of the file. It causes Code Finder to start a little slower.

[robg adds: I edited this comment to restore the missing backslashes...]

[ Reply to This | # ]

Update code files in /usr/share/misc
Authored by: MaxMouseroom on Aug 11, '03 03:37:23PM

Some of the regular expressions I used in the one-liner above got hozed in the translation when I posted this. If anyone wants the working version, I'll have to email it to them. Reach me here: sswell at yahoo.com



[ Reply to This | # ]
Should be OK now...
Authored by: robg on Aug 11, '03 04:28:39PM

I edited the comment to replace the missing characters (Geeklog killed them).

-rob.



[ Reply to This | # ]
Update code files in /usr/share/misc
Authored by: MaxMouseroom on Aug 12, '03 04:31:08PM
Sorry, the code was still garbled by Geeklog. Let me try it again. Put this all on one line:

sudo curl -s http://www.mapping.com/airportcodes.html | 
awk '/A00/,/9Z9/' | perl -ne '$/=";"; s#  ?##g; s#\n##g; 
s#<.><..>.*$##i; s#<.*?>##g; s#^\s+##; s#^\s*$##; s#\s+#:#;
print "$_\n"' > /usr/share/misc/airport
[\code]


[ Reply to This | # ]