Guest User

Untitled

a guest
Jan 15th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. LYRICS_FILE=$1
  4.  
  5. previous_timing=
  6. previous_text=
  7.  
  8. counter=1
  9.  
  10. while IFS='' read -r line; do
  11. if [ -n "$line" ]; then
  12. timing=`echo "$line" | sed 's/ .*//'`
  13. text="`echo "$line" | sed 's/^[^ ]* \?//'`"
  14.  
  15. if [ -n "$previous_timing" -a -n "$previous_text" ]; then
  16. echo $counter
  17. echo "00:$previous_timing --> 00:$timing"
  18. echo "$previous_text"
  19. echo
  20.  
  21. counter=`expr $counter + 1`
  22. fi
  23.  
  24. previous_timing=$timing
  25. previous_text="$text"
  26. fi
  27. done <$LYRICS_FILE
  28.  
  29. if [ -n "$previous_text" ]; then
  30. echo $counter
  31. echo "00:$previous_timing --> 00:$timing"
  32. echo "$previous_text"
  33. echo
  34. fi
Add Comment
Please, Sign In to add comment