Skip to content

Instantly share code, notes, and snippets.

@vmassuchetto
Last active December 21, 2015 06:09
Show Gist options
  • Save vmassuchetto/6261929 to your computer and use it in GitHub Desktop.
Save vmassuchetto/6261929 to your computer and use it in GitHub Desktop.
Replace Youtube oEmbed entries by iframe tags in text files
#!/bin/bash
for FILE in `rgrep -il "youtube.com" * | grep -v iframe` ; do
perl -p -i -e 's/(<p>)?.*youtube\.com\/watch.*v=([A-Za-z0-9]*).*(<\/p>)?/<iframe width="560" height="315" frameborder="0" src="\/\/www\.youtube\.com\/embed\/\2\" allowfullscreen><\/iframe>/g' $FILE ;
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment