Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/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