What
I'd like to turn the iana backward timezones file into a json file with unique keys, but in order to do that I'll have to make sure that the keys become the values and vice versa.
That's because a json file can't have duplicate keys.
Example:
That file contains lot's of duplicate links, but for this example let's use these two:
Link America/Toronto America/Montreal
Link America/Toronto Canada/Eastern
I want those to turn into:
"America/Montreal": "America/Toronto", "Canada/Eastern": "America/Toronto",
so that they both output Toronto.
What I've tried so far:
The regular expression I've made so far is this:
- search for:
^Link[\s]*([a-zA-Z\/\-]*)[\s]*([a-zA-Z\/\-]*)$
- replace with:
"\2" : "\1",
Finally I tried doing this with sed like so:
sed -E 's|^Link[\s]*([a-zA-Z\/\-]*)[\s]*([a-zA-Z\/\-]*)$|"\2" : "\1"|' ./backward
but for some reason it keeps outputting the whole file without substituting anything.
What am I doing wrong?