Skip to content

Instantly share code, notes, and snippets.

@gvieira
Created October 21, 2013 12:49
Show Gist options
  • Save gvieira/7083365 to your computer and use it in GitHub Desktop.
Save gvieira/7083365 to your computer and use it in GitHub Desktop.
Adjust str encoding and rename it according to movie name.
# Set encoding to UTF-8
for f in *.srt; do iconv -f `file --mime-encoding -b "$f"` -t UTF-8 "$f" > "$f.u"; mv "$f.u" "$f"; done
# Rename according to movie
ls *.srt | while read f; do n=`grep -o 'S..E..' <<< "$f"`; m=`ls -1 *"$n"* | grep -v "\.srt$"`; o=${m%.*}; mv "$f" "$o.srt"; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment