Created
November 26, 2013 22:10
-
-
Save fabiosantoscode/7667221 to your computer and use it in GitHub Desktop.
ini to JSON converter written in SED
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# whitespace trim | |
s/\s\+=/=/ | |
s/^\s+// | |
s/=\(\s\+\)\?/=/ | |
# escaping quotes | |
s/"/\\"/g | |
# split by the equal sign | |
s/\(.*\?\)=\(.\+\)/"\1": "\2",/ | |
# indent | |
s/^/ / | |
# First line and last line | |
$ s/,$/\n}/ | |
1 s/^/{\n/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment