blob: aac47d3eef376ce009bc944b53a46ea0c6519ac6 (
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
|
#!/bin/sh
# na.phone:
# Area Code : City : State/Province : State/Province Abbrev.
# areas:
# Area Code : State/Province|State/Province Abbrev. : City
if [ X"$1" == X"" ]; then
exit 1
fi
awk '{
split($0, a, ":");
if (a[1] ~ /^[0-9]+$/) {
if (last != a[1]) {
if (a[4] == "")
print a[1] ":" a[3] ":" a[2];
else
print a[1] ":" a[3] "|" a[4] ":" a[2];
}
}
last = a[1];
}' $1
|