[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

process null-delimited input

From: Nathan Coulter
Subject: process null-delimited input
Date: Thu, 07 Sep 2006 08:38:25 -0700

I'd like to use a bash script in a pipe to process null-delimited output:

<produce null-delimited output> | myscript > results

Since the "read" command seems to currently be unable to use ascii null as a 
delimiter, I'm using xargs to parse the file and feed to a subshell:

*** contents of myscript***

cat <&0 | xargs -0 -n2 bash -c '                                                
        if test "$(eval dirname \"$0\")" = "${1/%\/}"; then                     
                printf "remove %s which points to %s\n" "$0" "$1"               

Anyone care to suggest alternative approaches?

Nathan "pooryorick" Coulter
"Know, thyself, unknowable, fool!"

reply via email to

[Prev in Thread] Current Thread [Next in Thread]