#!/bin/bash
function input
{
cat << \EOF
abc
def
this is foobar
ghi
jki
more foobar
blee
blah
bleach
EOF
}
input | ./context-split -s '^.*foobar.*$' -i
if [ $(ls ? | wc -l) = 3 ]
then
rm -f ?
exit 0
else
echo "$0: Did not find 3 subfiles" 1>&2
exit 1
fi