Re: mapfile question: Is there a better way to avoid the trailing newlin
From:
Chet Ramey
Subject:
Re: mapfile question: Is there a better way to avoid the trailing newline?
Date:
Wed, 1 Oct 2025 16:27:51 -0400
User-agent:
Mozilla Thunderbird
On 10/1/25 2:49 PM, Stan Marsh wrote:
But is there a way to avoid the problem in the first place? (while
still using mapfile, though I am open to other suggestions)
You can't do it with mapfile and here-strings, since you're asking it to
deal with two delimiters.
You can do it with
enable -f ./examples/loadables/dsv dsv
dsv -d $'\t' -g "$foo"
declare -p DSV
You can add -S or not, it depends on the structure of your input and
what you want from it.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/