#! /bin/bash for data in ./data/*; do echo "draw $data …" cat $data | sed -e '1agraph G {' -e '1d; s/ / -- /; s/$/;/' -e '$a}' | dot -Tpng -o ${data}.png done