Skip to content

Instantly share code, notes, and snippets.

@steshaw
Created September 9, 2021 10:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save steshaw/ba6131b492ee1bfea14fe6886ef94083 to your computer and use it in GitHub Desktop.
Save steshaw/ba6131b492ee1bfea14fe6886ef94083 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
set -euo pipefail
# Explanation of strange Perlness:
#
# * -0400 means that we slurp the whole file rather than operating on a
# line-by-line basis.
# * /gms means global, multiline, '.' can match '\n' (probably not needed in
# this case).
#
perl -00400 -i -pe 's/^}\nfunc/}\n\nfunc/gms' "${@}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment