:
grep -Po '.{5}|.*' <<< "abcdefghijklmnopqrstuvwxyz"
grep -Po '.{1,5}' <<< "abcdefghijklmnopqrstuvwxyz"
prints
abcde
fghij
klmno
pqrst
uvwxy
z
Or using a script
input=encrypted2.txt
while read -r -n5 ch
do
echo "$ch"
done < "$input" >output.txt
jm666 source
share