#!/usr/bin/awk -f # mshow.awk v0.1 # Igor Wojnicki,2000-2001,GPL # wojnicki@agh.edu.pl BEGIN{ RS="\r"; FS=":"; TXT=""; # text to display TIM=0; # at this time MAXTIME=0; FIL=ARGV[1]; # a file with the text ARGV[1]="" # to force stdin to work for me printf "\n\n\n\n" } END{ printf "\n\nThat's it !\n" exit 0 } /A/ { split($2,TIME,"."); # TIME[1] a real time of the movie in seconds # MAXTIME = a maximum time reached during playback if (TIME[1]>MAXTIME) MAXTIME=TIME[1]; # if a rewind occured if (MAXTIME>TIME[1]){ close(FIL); MAXTIME=TIME[1]; TXT=""; } # if a new text should be read if (TXT=="") { RS="\n"; do { getline LINE < FIL; split(LINE,DAT,":"); TIM=DAT[1]*3600+DAT[2]*60+DAT[3]; TXT=DAT[4]; } while (TIM