[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: builtin read stops at '\0'
From: |
Greg Wooledge |
Subject: |
Re: builtin read stops at '\0' |
Date: |
Thu, 19 May 2011 09:34:38 -0400 |
User-agent: |
Mutt/1.4.2.3i |
On Thu, May 19, 2011 at 03:23:55PM +0200, Rafaël Fourquet wrote:
> I have a program which outputs groups of filenames. Each group is separated
> by a newline, and within each group,
> each name is separated by '\0'.
That seems backwards somehow... the "stronger" delimiter (NUL) is used
in the inner group, and the "weaker" delimiter (newline) in the outer.
Oh well -- I assume you have no control over that.
Here's what I'd do: just use tr to swap the delimiters.
while read -d '' -r group; do
mapfile -t files <<< "$group"
...
done < <(tr '\n\0' '\0\n' < "yourfile")
> I want to pipe each group to xargs -0.
Not what I'd do.