#!/usr/bin/env sh # convert a plain txt data file with 4 numerical columns (atom type,x,y,z) # into a valid xyz file # commented lines in the original data file are omitted tmp=$(mktemp) cat $@ > $tmp grep -v "^#" $tmp | wc -l echo "# converted by $0" awk '/^[^#]/{print $1,$2,$3,$4}' $tmp trap "rm $tmp" SIGINT SIGTERM SIGUSR1 EXIT