# Quick Summary The xpipe command reads input from stdin and splits it by the given number of bytes, lines, or if matching the given pattern. It then invokes the given utility repeatedly, feeding it the generated data chunks as input. You can think of it as a Unix love-child of the split(1), tee(1), and xargs(1) commands. It is generally most useful when you have input data that you want to feed in chunks one at a time into the same command. So for example, consider the following conceptual sequence of commands: ``` head -20 input | command head -40 input | tail -20 | command head -60 input | tail -20 | command ``` or ``` split -n 100 ../input for f in *; do command <$f done ``` These might be replaced with single line invocations of `xpipe(1)`. This is particularly useful when you need to extract data from the input in more complex ways: Suppose you have a file 'certs.pem' containing a number of x509 certificates in PEM format, and you wish to extract e.g., the subject and validity dates from each. The openssl x509(1) utility can only accept a single certificate at a time, so you'll have to first split the input into individual files containing exactly one cert, then repeatedly run the x509(1) command against each file. And, let's be honest, you probably have to google how to use sed(1) or awk(1) to extract subsequent blocks from a flip-flop pattern. xpipe(1) can do the job for you in a single command: ``` $ %.out" EXAMPLES The following examples illustrate common usage of this tool. Suppose you have a large number of files in your current directory and wish to create tar archives containing 1000 files each: $ ls | wc -l 100000 $ ls | xpipe -n 1000 -J % tar zcf ../archives/%.tgz --files-from - $ ls ../archives/*.tgz | wc -l 100 To split a large, uncompressed log file into multiple, compressed files, named 1.gz, 2.gz, ... n.gz, you could use split(1), and then iterate over each file and compress it; with xpipe, this becomes a one-liner: $ %.gz" To extract the subjects of all certificates in a standard PEM formatted x.509 trust bundle: $ in January 2020. BUGS Please file bugs and feature requests by emailing the author. ```