Skip to content

Instantly share code, notes, and snippets.

@emanchado
Created January 15, 2019 19:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save emanchado/30a5f0591ff897b9ac5e308adefcdea3 to your computer and use it in GitHub Desktop.
Save emanchado/30a5f0591ff897b9ac5e308adefcdea3 to your computer and use it in GitHub Desktop.
#!/bin/bash
LYRICS_FILE=$1
previous_timing=
previous_text=
counter=1
while IFS='' read -r line; do
if [ -n "$line" ]; then
timing=`echo "$line" | sed 's/ .*//'`
text="`echo "$line" | sed 's/^[^ ]* \?//'`"
if [ -n "$previous_timing" -a -n "$previous_text" ]; then
echo $counter
echo "00:$previous_timing --> 00:$timing"
echo "$previous_text"
echo
counter=`expr $counter + 1`
fi
previous_timing=$timing
previous_text="$text"
fi
done <$LYRICS_FILE
if [ -n "$previous_text" ]; then
echo $counter
echo "00:$previous_timing --> 00:$timing"
echo "$previous_text"
echo
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment