Skip to content

Instantly share code, notes, and snippets.

@jordiclariana
Created December 9, 2014 09:02
Show Gist options
  • Save jordiclariana/4bab1fabb5101bc3f9a8 to your computer and use it in GitHub Desktop.
Save jordiclariana/4bab1fabb5101bc3f9a8 to your computer and use it in GitHub Desktop.
BEGIN {
STARTBLOCK="{"
CONDITION="REMOVEME"
ENDBLOCK="}"
}
{
if ($0 ~ STARTBLOCK) {
block[nf=1] = $0
flag=1
} else if (flag==1) {
if ($0 ~ ENDBLOCK) {
if (notprint==0) {
for (x=1;x<=nf;x++) {
print block[x]
}
print $0
} else { notprint=0 }
flag=0
} else {
if ($0 ~ CONDITION) {
notprint=1
} else {
block[++nf] = $0
}
}
} else {
print $0
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment