Hi Julian,

jhx <jhx0...@gmail.com> 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 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).

If I understood your intention and patch correctly, cut should already
do what you need:

  ~$ perl -e 'print "A" x 800, "\n";' | cut -c -50
  AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
  ~$ perl -e 'print "A" x 8, "\n";' | cut -c -50 | cat --show-ends
  AAAAAAAA$

Check out ``(coreutils)cut invocation''.

> Attached you will find the patch for 'fold'.
>
> Apologies if there is something missing/wrong - Never contributed to any GNU
> software before. :)

Welcome!  Great having you.  :-D

> Greetings
>
> Julian "jhx"
>
> [2. text/x-patch; fold-cut-line.patch]...

Hope that helps!

Have a most wonderful day.
-- 
Arsen Arsenović

Attachment: signature.asc
Description: PGP signature

Reply via email to