== test file: TOS-de.srt (German, 76 cues, LF line endings) == published: grep -c -- '-->' TOS-de.srt file: TOS-de.srt 76 exit=0 published: diff <(grep -- '-->' TOS-en.srt | tr -d '\r') <(grep -- '-->' TOS-de.srt | tr -d '\r') file: TOS-en.srt vs TOS-de.srt, CR removed (diff exits 0 when equal) exit=0 published: diff <(grep -- '-->' TOS-en.srt | tr -d '\r') <(grep -- '-->' TOS-es.srt | tr -d '\r') file: TOS-en.srt vs TOS-es.srt, CR removed (one cue start moved, exit 1) 9c9 < 00:00:42,200 --> 00:00:45,000 --- > 00:00:43,000 --> 00:00:45,000 exit=1 published: awk 'length($0)>42' TOS-de.srt | wc -l file: TOS-de.srt 7 exit=0 published: for f in TOS-en TOS-de TOS-es TOS-it TOS-nl TOS-ru; do echo "$f $(grep -c -- '-->' $f.srt)"; done file: six files TOS-en 76 TOS-de 76 TOS-es 76 TOS-it 76 TOS-nl 76 TOS-ru 76 exit=0 == edge: the same German file saved with Windows line endings (CRLF) and a BOM == edge: awk on the CRLF copy counts every line one character longer published: awk 'length($0)>42' TOS-de-crlf.srt | wc -l file: TOS-de-crlf.srt 8 exit=0 edge: stripping CR first gives the LF answer back published: tr -d '\r' < TOS-de-crlf.srt | awk 'length($0)>42' | wc -l file: TOS-de-crlf.srt 7 exit=0 edge: the same diff without tr: English has CRLF line endings and German has LF, so every line differs although the timestamps are equal published: diff <(grep -- '-->' TOS-en.srt) <(grep -- '-->' TOS-de.srt) | grep -c '^<' file: TOS-en.srt (CRLF) vs TOS-de.srt (LF), no tr 76 exit=0 edge: the cue count is the same with CRLF published: grep -c -- '-->' TOS-de-crlf.srt file: TOS-de-crlf.srt 76 exit=0 edge: non-Latin text. The same awk count on the Russian file: gawk counts characters, mawk (the default awk on Ubuntu) counts bytes published: tr -d "\r" < TOS-ru.srt | gawk "length(\$0)>42" | wc -l file: TOS-ru.srt, gawk 1 exit=0 published: tr -d "\r" < TOS-ru.srt | mawk "length(\$0)>42" | wc -l file: TOS-ru.srt, mawk (counts bytes: wrong for Cyrillic) 31 exit=0 published: tr -d "\r" < TOS-ru.srt | python3 -c "import sys; print(sum(len(l.rstrip(chr(10)))>42 for l in sys.stdin))" file: TOS-ru.srt, Python (counts characters) 1 exit=0