#! /bin/bash # add zero columns so columns in old plot file map to correct columns in new plot file # invocation: oldplot2newplot file # grab and count command arguments let ncmdarg=0 for ncmd in $* do let ncmdarg=ncmdarg+1 done # check command argument count, zero means none if [[ ncmdarg -eq 0 ]] then echo 'invocation: oldplot2newplot plot.out' exit fi cat $1 | dm 'if x<2 then INPUT else SKIP' > ${1}.new cat $1 | dm 'if x>=2 then INPUT else SKIP' | dm "if N<2 then '0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0' else INPUT" | dm x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x62 x62 x14 x62 x62 x62 x15 x16 x62 x62 x62 x17 x18 x19 x20 x21 x22 x23 x24 x25 x26 x27 x28 x29 x30 x31 x32 x33 x34 x35 x36 x37 x38 x39 x40 x41 x42 x43 x44 x45 x46 x47 x48 x49 x50 x51 x52 x53 x54 x55 x56 x57 x58 x59 x60 x61 x62 x62 x62 x62 x62 x62 x62 x62 | dm "if x1 > 0 then INPUT else ''" >> ${1}.new exit