Created
May 30, 2019 09:23
-
-
Save geekman/ebf973adbd0141ac24fedee5c8aca955 to your computer and use it in GitHub Desktop.
replaces patterns like "<? cmd ?>" by executing cmd
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
# | |
# awk one-liner to replace patterns like "<? cmd ?>" by executing cmd | |
# handy for use in config files "templates" | |
# | |
cat <<EOF | awk '{ if (match($0, /<\?(.*)?>/)) { cmd = substr($0, RSTART+2, RLENGTH-2-2); system(cmd) } else print }' | |
my directory has these files: | |
<? ls / ?> | |
EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment