#!/bin/bash printf '' > output-bad-checksums.txt2 n=$(cat *.txt | wc -l) cat *.txt | { i=0 bad=0 bad_bef=0 while IFS= read -r line; do i=$((i+1)) bad_bef=`echo $bad` line_act=`echo $line | sed 's/^.................................//g'` echo "$line" | md5sum -c - || bad=$((bad+1)) if [[ $bad_bef < $bad ]]; then echo "$line" >> output-bad-checksums.txt2 fi clear echo -e "$i/$n - checking: \n\n$line_act" done [ $bad -eq 0 ] || { echo "$bad bad checksums"; false; } }