you can use fmt
e.g. 10 bytes
$ cat file
a quick brown fox jumps over the lazy dog
good lord , oh my gosh
$ tr '\n' ' '<file | fmt -w10 file
a quick
brown fox
jumps
over
the lazy
dog good
lord , oh
my gosh
Each line has 10 characters. If you want to read the second snippet, pass it on to tools like awk..eg
$ tr '\n' ' '<file | fmt -w10 | awk 'NR==2'
brown fox
To save each fragment to a file (or you can use splitwith -b)
$ tr '\n' ' '<file | fmt -w10 | awk '{print $0 > "file_"NR}'
source
share