Skip to content

Instantly share code, notes, and snippets.

@stevenschobert
Created February 29, 2016 18:28
Show Gist options
  • Select an option

  • Save stevenschobert/9640f5ca90941e74bd6c to your computer and use it in GitHub Desktop.

Select an option

Save stevenschobert/9640f5ca90941e74bd6c to your computer and use it in GitHub Desktop.
Tab separate list of US states and their respective 2 letter codes
Alabama Ala. AL
Alaska Alaska AK
Arizona Ariz. AZ
Arkansas Ark. AR
California Calif. CA
Colorado Colo. CO
Connecticut Conn. CT
Delaware Del. DE
Dist. of Columbia D.C. DC
Florida Fla. FL
Georgia Ga. GA
Guam Guam GU
Hawaii Hawaii HI
Idaho Idaho ID
Illinois Ill. IL
Indiana Ind. IN
Iowa Iowa IA
Kansas Kans. KS
Kentucky Ky. KY
Louisiana La. LA
Maine Maine ME
Maryland Md. MD
Massachusetts Mass. MA
Michigan Mich. MI
Minnesota Minn. MN
Mississippi Miss. MS
Missouri Mo. MO
Montana Mont. MT
Nebraska Nebr. NE
Nevada Nev. NV
New Hampshire N.H. NH
New Jersey N.J. NJ
New Mexico N.M. NM
New York N.Y. NY
North Carolina N.C. NC
North Dakota N.D. ND
Ohio Ohio OH
Oklahoma Okla. OK
Oregon Ore. OR
Pennsylvania Pa. PA
Puerto Rico P.R. PR
Rhode Island R.I. RI
South Carolina S.C. SC
South Dakota S.D. SD
Tennessee Tenn. TN
Texas Tex. TX
Utah Utah UT
Vermont Vt. VT
Virginia Va. VA
Virgin Islands V.I. VI
Washington Wash. WA
West Virginia W.Va. WV
Wisconsin Wis. WI
Wyoming Wyo. WY
@stevenschobert
Copy link
Author

Awk it up to get just specific columns:

cat states.txt | awk 'BEGIN { FS = "    " } ; { print $3 }' # for state codes
cat states.txt | awk 'BEGIN { FS = "    " } ; { print $1 }' # for state names

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment