#!/bin/sh . $HOME/.bin/_config for file in $(ls -1p $PIMDIR/contacts); do printf "%s %s\n" "$file" "$(cut -d":" -f2- $PIMDIR/contacts/$file | tr '\n' ',')" done