FWIW, we can do that with sed. Here's an example to crop at 50 chars (this example uses perl to generate two lines of different lengths).
$ perl -le 'print "a" x 40; print "a" x 80' | sed -E 's/^(.{50}).+/\1.../' aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa... On Sat, Feb 11, 2023 at 9:57 AM jhx <jhx0...@gmail.com> wrote: > Hello everyone, > > I personally often use 'fold' to break up some long lines, which works > well. Lately I have been in the need to cut of a line at a specific > length - removing the rest of the line. I made a small patch for 'fold' > to do just that. The line gets cut off at WIDTH (specified via -w WIDTH) > and three dots will be printed for a more appealing output. The new > option added is '-c' for 'cut'. > I checked out the newest code via Git and compiled 'fold' with the patch > attached to this mail. (No errors/warnings were output). > > Attached you will find the patch for 'fold'. > > Apologies if there is something missing/wrong - Never contributed to any > GNU software before. :) > > Greetings > > Julian "jhx"