Guest User

Untitled

a guest
Aug 5th, 2018
34
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. [0003: ~/.zipcodes]$ head .allCountries.txt
  2. AD AD100 Canillo 42.5833 1.6667 6
  3. AD AD200 Encamp 42.5333 1.6333 6
  4. AD AD300 Ordino 42.6 1.55 6
  5. AD AD400 La Massana 42.5667 1.4833 6
  6. AD AD500 Andorra la Vella 42.5 1.5 6
  7. AD AD600 Sant Julià de Lòria 42.4667 1.5 6
  8. AD AD700 Escaldes-Engordany 42.5 1.5667 6
  9. AR 3636 POZO CERCADO (EL CHORRO (F), DPTO. RIVADAVIA (S)) Salta A -23.4933 -61.9267 3
  10. AR 4123 LAS SALADAS Salta A -25.7833 -64.5 4
  11. AR 4126 CEIBAL Salta A -26.1 -65.0167 4
  12.  
  13.  
  14. ======
  15.  
  16.  
  17. [0003: ~/.zipcodes]$ cat .awkit.sh
  18. #!/bin/bash
  19.  
  20. wDir="/home/.zipcodes"
  21. inFile=".allCountries.txt"
  22. outFile=".allCountries-formatted.txt"
  23.  
  24. cd "$wDir"
  25. rm -f "$outFile"
  26. awk '{printf "%s %-6s%-81s%-12s%-12s%s\n",$1,$2,gensub(/[0-9.-]* +[0-9.-]* +[0-9]$/,"","g",substr($0,10)),$(NF-2),$(NF-1),$NF}' "$inFile" | head > "$outFile"
  27. cat "$outFile"
  28.  
  29.  
  30. =======
  31.  
  32.  
  33. [0003: ~/.zipcodes]$ bash .awkit
  34. AD AD100 Canillo 42.5833 1.6667 6 42.5833 1.6667 6
  35. AD AD200 Encamp 42.5333 1.6333 6 42.5333 1.6333 6
  36. AD AD300 Ordino 42.6 1.55 6 42.6 1.55 6
  37. AD AD400 La Massana 42.5667 1.4833 6 42.5667 1.4833 6
  38. AD AD500 Andorra la Vella 42.5 1.5 6 42.5 1.5 6
  39. AD AD600 Sant Julià de Lòria 42.4667 1.5 6 42.4667 1.5 6
  40. AD AD700 Escaldes-Engordany 42.5 1.5667 6 42.5 1.5667 6
  41. AR 3636 OZO CERCADO (EL CHORRO (F), DPTO. RIVADAVIA (S)) Salta A -23.4933 -61.9267 3 -23.4933 -61.9267 3
  42. AR 4123 AS SALADAS Salta A -25.7833 -64.5 4 -25.7833 -64.5 4
  43. AR 4126 EIBAL Salta A -26.1 -65.0167 4 -26.1 -65.0167 4
RAW Paste Data