Created
January 15, 2019 19:05
-
-
Save emanchado/30a5f0591ff897b9ac5e308adefcdea3 to your computer and use it in GitHub Desktop.
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 | |
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