emulate join and split in bash (sort of)