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.