Last active
February 20, 2022 23:13
-
-
Save vmanyushin/a02d2d24f2ad552693229c7f3bbc49ac to your computer and use it in GitHub Desktop.
This file contains 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
#!/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} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
from here https://evasive.ru/f29bd7ebacf24a50c582f973a55eee28.html