Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/usr/bin/awk -f
{sub(/^[ \t]+/,"");idx=0}
/\{/{ctx++;idx=1}
/\}/{ctx--}
{id="";for(i=idx;i<ctx;i++)id=sprintf("%s%s", id, "\t");printf "%s%s\n", id, $0}
#!/usr/bin/awk -f
# 4 space edition
{sub(/^[ \t]+/,"");idx=0}
/\{/{ctx++;idx=1}
/\}/{ctx--}
{id="";for(i=idx;i<ctx;i++)id=sprintf("%s%s", id, " ");printf "%s%s\n", id, $0}
@vmanyushin

This comment has been minimized.

Copy link
Owner Author

@vmanyushin vmanyushin commented Aug 29, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.