Created
January 19, 2018 22:40
-
-
Save daskol/382ed5cef98cc1236b34e3d520b74353 to your computer and use it in GitHub Desktop.
Inject Yandex Metrica counter into all HTML files after <body> tag.
This file contains hidden or 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/bash | |
| # inject-metrica.sh | |
| # Inject Yandex Metrica counter into all HTML files after <body> tag. | |
| COUNTER='<put Yandex Metrica one-line counter here>' | |
| COUNTER=$(sed 's/\//\\\//g' <<< $COUNTER) | |
| for file in $(ls *.html); do | |
| echo "processing $file" | |
| sed -i "s/<body>/<body>\n$COUNTER/g" $file | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment