Last active
October 30, 2023 19:36
-
-
Save xonixx/c8ab6b3f192ecbf416ab55dd6536b678 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 | |
BEGIN { | |
if (!Tag) { print "must set Tag!"; exit 1 } | |
} | |
$1 == (Tag ":") { | |
StartedSkip = 1 | |
Spaces = index($0, Tag) | |
next | |
} | |
StartedSkip { | |
match($0,/^\s+/) | |
spaces1 = RLENGTH | |
if (spaces1 > Spaces) { | |
# skipping | |
} else { | |
# stop skipping | |
StartedSkip = 0 | |
} | |
next | |
} | |
1 |
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
# usage | |
awk -v Tag='x-code-samples' -f ./yamlrmtag.awk swagger.yaml > swagger_1.yaml |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment