directory="${1}" total_lines=0 while IFS= read -r -d '' file; do lines=$(wc -l < "$file") total_lines=$((total_lines + lines)) echo "File '$file' includes $lines lines" done < <(find "$directory" -name "*.jsonl" -type f -print0) echo echo "All lines from directory ${directory}: $total_lines"