I have a file with country, city and state info, among other information. The content of the file looks something like this: (only the part pertaining to the question shown)
Some lines (rows) of text
...
United States
Memphis, TN 38116-3252
...
More lines of text
...
United States
Austin, TX 78726
...
What I would like to do is add a newline before the zip code or after TN (for example) and also replace the ',' with a newline. But I'm assuming the second part will be easier.
Desired format:
Some lines (rows) of text
...
United States
Memphis
TN
38116-3252
...
More lines of text
...
United States
Austin
TX
78726
...
The end goal is to import the data into a spreadsheet like:
Some info | Country | State | City | Etc.
abc | United..| Texas | Austi| zcx
I'm open for anything that works sed, awk, etc.