I have a 0-byte-delimited file of records.Record 1, Line 1Record 1, Line 2[zero byte]Record 2, Line 1Record 2, Line 2I'd like to run the process.sh command once for each record, with the record as standard input:bash process-one-record-stdin.sh <record-contentsCan I do this with xargs, parallel, or some other tool? (I know how using bash scripting, but I'd prefer to use  built-in tools where possible)Motivation:magic-xargs-type-command-here -0 all-records.txt -- xargs -d\n -- bash process-one-record-arguments.sh
xargs, records, and standard input
xargs;gnu parallel
If you have GNU Parallel you can do this:parallel --rrs --recend '\0' -N1 --pipe bash process-one-record-stdin.sh <record-contentsAll new computers have multiple cores, but most programs are serial in nature and will therefore not use the multiple cores. However, many tasks are extremely parallelizeable:Run the same program on many filesRun the same program for every line in a fileRun the same program for every block in a fileGNU Parallel is a general parallelizer and makes is easy to run jobs in parallel on the same machine or on multiple machines you have ssh access to.If you have 32 different jobs you want to run on 4 CPUs, a straight forward way to parallelize is to run 8 jobs on each CPU:GNU Parallel instead spawns a new process when one finishes - keeping the CPUs active and thus saving time:InstallationIf GNU Parallel is not packaged for your distribution, you can do a personal installation, which does not require root access. It can be done in 10 seconds by doing this:(wget -O - pi.dk/3 || curl pi.dk/3/ || fetch -o - http://pi.dk/3) | bashFor other installation options see http://git.savannah.gnu.org/cgit/parallel.git/tree/READMELearn moreSee more examples: http://www.gnu.org/software/parallel/man.htmlWatch the intro videos: https://www.youtube.com/playlist?list=PL284C9FF2488BC6D1Walk through the tutorial: http://www.gnu.org/software/parallel/parallel_tutorial.htmlSign up for the email list to get support: https://lists.gnu.org/mailman/listinfo/parallel