I would like to print the tail
of a file (could be also head
or cat
in general) to the screen but restrict the number of characters per line.
So if a file contains ...
abcdefg
abcd
abcde
abcdefgh
... and the maximum number is 5, then the following should be printed:
abcde
abcd
abcde
abcde
How would I do that?
cut
, that only works for single-byte characters (it returns only the first 5 bytes of each line). Hopefully, that will be fixed in a future version (some vendors like RedHat I believe have patches for that). – Stéphane Chazelas Aug 09 '16 at 13:45