Index: mttroot/mtt/bin/trans/rbg_fig2m ================================================================== --- mttroot/mtt/bin/trans/rbg_fig2m +++ mttroot/mtt/bin/trans/rbg_fig2m @@ -13,10 +13,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.7 2001/07/24 22:42:59 geraint +## Fixes problem when lbl.txt does not end with newline. +## ## Revision 1.6 2001/05/24 07:48:17 gawthrop ## Include artwork in the cbg.fig file ## ## Revision 1.5 2001/03/23 14:56:21 gawthrop ## Now puts space after header fields + write _port.fig @@ -60,18 +63,34 @@ touch $1_head.fig touch $1_cmp.fig touch $1_port.fig touch $1_bnd.fig touch $1_art.fig + +# Deletes trailing white space in component names +sed 's/[ ]*\\001/\\001/' < $1_abg.fig >$1_abg.mtt1 + +# Replace [1:5] with [1,2,3,4,5] +awk '{ + if (match($14, /\[1:[0-9]*\]/)){ + range = substr($14,2,length($14)-6); + split(range,a,":"); + str = "1"; + for (i=2;i<=a[2];i++) str = sprintf("%s,%i", str, i); + sub(/1:[0-9]*/, str, $14); + } + print $0 +}' < $1_abg.mtt1 > $1_abg.mtt2 + # The following horrible sed thing is to replace tab by ---- # this is because I can't get sed to recognise tabs even if FS=" ". -echo "" > $1_abg.mtt -sed 's/ /---- /'<$1_abg.fig >> $1_abg.mtt +echo "" > $1_abg.mtt3 +sed 's/ /---- /'<$1_abg.mtt2 >> $1_abg.mtt3 # This is the main transformation using awk -cat $1_lbl.txt $1_abg.mtt | awk -f $MTTPATH/trans/awk/rbg_fig2m.awk $1 +cat $1_lbl.txt $1_abg.mtt3 | awk -f $MTTPATH/trans/awk/rbg_fig2m.awk $1 rm -f $1_abg.mtt #Create the stripped abg file cat $1_head.fig $1_bnd.fig $1_cmp.fig> $1_sabg.fig