>>8930 >max_consecutive_greentext_lines >don't care about lines that look like /^\s*>>\d+$/ here: >$ cat 40244033 | tr -d \\r | perl -pE "s/\n\s+>/\n>/g" | perl -pE "s/^\s*>>\d+\n//g" | perl -pE "s/^\s*>.*\n/\0/g" | grep -Pao "\0+" | awk ' {print length ($1)}' | sort -rn | head -n1 >8 >$ Just gotta put it in a loop now (all modifications to stdout): - removes \r which probably only shows up as something like \r\n, so only \n is needed - removes "[start of line]>>[numbers][end of line]", doesn't count as greentext - (I thought of this solution ~12 hours ago, now doing it) reduces all lines which match "[start of line][zero or more whitespace characters]>[zero or more characters][newline]" to a null byte. - search for lines containing one or more null bytes, print the length of those lines with the biggest number at the top and only get that number