Skip to content

Instantly share code, notes, and snippets.

@jsoref
Created October 13, 2017 19:06
Show Gist options
  • Save jsoref/e44bd8c07391340284baeaa018001e6c to your computer and use it in GitHub Desktop.
Save jsoref/e44bd8c07391340284baeaa018001e6c to your computer and use it in GitHub Desktop.
indent exim conf if else endif
#!/usr/bin/perl -n
# argument: /path/to/exim.conf
if (/^\s*\.else/) {
$spaces=" "x($level-1);
print $spaces.$_; next;
}
if (/^\s*\.if/) {
$spaces=" "x$level;
print $spaces.$_;
$level++; next;
}
if (/^\s*\.endif/) {
$level--;
$spaces=" "x$level;
print $spaces.$_;
next;
}
$spaces=" "x$level;
print $spaces.$_;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment