summaryrefslogtreecommitdiff
path: root/ipl/gpacks/tiger/tgrsort
blob: 825f5bdc40853c987d33e1d929029d94d5236ae4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/sh
#
#  tgrsort [file] -- sort TIGER line chains
#
#  Sort keys are:
#
#  1. CFCC feature class, in this order:
#	boundary
#	water
#	other topographic feature  (rare)
#	road
#	railroad
#	pipeline, power line, etc.
#	landmark
#	unclassified
#
#   2. Major category, largest (least significant) first
#
#   The feature class and category sorting is chosen so that more important
#   chains are drawn later, obscuring lesser chains, instead of the reverse.
#
#   Note that this sorting can reverse the positions of the first two lines
#   of the file (the min/max lines), but tgrmap.icn can handle that.

TR1=FHEABCDX
TR2=JKLMNPQR

cat $1 |
tr $TR1 $TR2 |
sort -t: -k 1.1,1.1 -k 1.2,1.3r -k 1.4 |
tr $TR2 $TR1