for filename in *.jpgdo text=$(tesseract "$filename" stdout | grep "LRP") cp "$filename" renamed/"$text".jpgdone## | cut -f2 -d":"| to only pick the second field to rename## cut -c == means skip the first and move to the second character## head -1 is used to only output the first line, isn't needed in this casefor filename in *.pngdo text=$(tesseract "$filename" stdout | grep "KH" | awk '{print $2} | cut -c 2-)cp "$filename" renamed/"$text".pngdone