Re: [PATCH] fold: Add '-c' (cut) option to cut off lines at a specific WIDTH

2023-02-11 Thread Arsen Arsenović
Hi Julian, jhx writes: > 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

Re: [PATCH] fold: Add '-c' (cut) option to cut off lines at a specific WIDTH

2023-02-11 Thread Michael Cook
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.../' aa

[PATCH] fold: Add '-c' (cut) option to cut off lines at a specific WIDTH

2023-02-11 Thread jhx
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 W