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/
