[prev in list] [next in list] [prev in thread] [next in thread] 

List:       coreutils
Subject:    Re: Utility of new program for coreutils?
From:       dualbus <dualbus () gmail ! com>
Date:       2017-06-02 14:12:43
Message-ID: 20170602141243.5pz3hnrl67d4zi6k () debian
[Download RAW message or body]

On Fri, Jun 02, 2017 at 04:32:15AM -0500, Tony Freeman wrote:
[...]
> So .. Would it be worth creating a new program, let's call it 'trim', that
> would: 1) remove whitespace from the beginning and end of stdin; and 2)
> remove newlines from beginning and end of a file?

Disclaimer: I'm not a coreutils maintainer, I'm just suscribed to the
list :-)


I suggest reviewing
https://www.gnu.org/software/coreutils/rejected_requests.html (specially
the section on new commands).

In my opinion, it's not very valuable to add a new command to Coreutils
to accomplish this specific problem, given that you can solve it with a
sed one-liner.

A similar topic was recently brought up in the mailing list, and Pádraig
provided a few suggestions on problems for new contributors:
https://lists.gnu.org/archive/html/coreutils/2017-05/msg00003.html

Perhaps you might want to review these?

> Example usage:
> 
> echo "        test      test test     test      " | trim

$ trim(){ sed -e 's/^[[:blank:]]*//' -e 's/[[:blank:]]*$//' -- "$@"; }
$ echo "        test      test test     test      " | trim
test      test test     test

-- 
Eduardo Bustamante
https://dualbus.me/


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic