Last active
April 20, 2023 18:14
-
-
Save coltborg/a0242c9b217b9c61aa050f41be35d999 to your computer and use it in GitHub Desktop.
Update fragment call in templates to use `~{}` syntax. First change file path to templates you want to affect.
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
#!/bin/sh | |
search_dir="/Users/alexgonzalez/Desktop/Code/form-flow/src/test/resources/templates" | |
# for each file in search directory and subdirectories, do the following | |
find "$search_dir" -type f -name "*.html" | while read file; do | |
sed -n ' | |
/\(fragments.*\)"/ { | |
s/\(fragments.*\)"/~{\1}"/g | |
p | |
s/.*// | |
h | |
} | |
!/\(fragments.*\)"/ { | |
H | |
$!d | |
} | |
$ { | |
p | |
} | |
' "$file" > "${file}.tmp" && mv "${file}.tmp" "$file" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment