]> git.lizzy.rs Git - plan9front.git/blob - rc/bin/ups
crop /lib/face/48x48x8/n/nixie.1 to the right size (was 512x512)
[plan9front.git] / rc / bin / ups
1 #!/bin/rc
2 # ups - look up a UPS tracking number
3 rfork en
4
5 if(! ~ $#* 1) {
6         echo usage: ups 1ZA41W190338680961 >[1=2]
7         exit usage
8 }
9
10 hget 'http://wwwapps.ups.com/WebTracking/processInputRequest?tracknum='^$1^ \
11         '&TypeOfInquiryNumber=T' >/tmp/ups.1
12
13 sed 's/<[Tt][Dd]>/& «TD»/g; s/<[Tt][Rr]>/&<td> «TR» /g' /tmp/ups.1 |
14         htmlfmt >/tmp/ups.2
15 sam -d /tmp/ups.2 >[2] /dev/null <<'!'
16 /^Tracking results.*/p
17 .,$d
18 /Help/d
19 1,.d
20 $-2,$d
21 /Status:/+1
22 .,/«TR»/-2d
23 ,s/\n/ /g
24 ,s/«TR»/\n/g
25 ,s/«TD»/      /g
26 ,s/ *    */     /g
27 ,s/^[   ]*//g
28 ,s/[    ]*$//g
29 ,s/\n\n+/\n\n/g
30 ,p
31 !
32 echo