Index: mttroot/mtt/bin/trans/lbl2alias_txt2txt ================================================================== --- mttroot/mtt/bin/trans/lbl2alias_txt2txt +++ mttroot/mtt/bin/trans/lbl2alias_txt2txt @@ -12,10 +12,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.2 1998/07/03 07:54:39 peterg +## Tidied +## ## Revision 1.1 1998/07/02 09:22:10 peterg ## Initial revision ## ## Revision 1.2 1998/07/02 08:34:00 peterg ## Renamed to lbl2alias_txt2txt @@ -31,20 +34,30 @@ #Create the alias file complete with headers. echo "# Alias file ($1_alias.txt)" > $1_alias.txt echo "# Generated by MTT at `date`" >> $1_alias.txt #Write out the variables -grep '[%|#]ALIAS' $1_lbl.txt |\ -awk '{ - n=split($2,a,"|"); - for (i=1; i<=n; i++) - print a[i],$3; - }' >> $1_alias.txt + grep '[%|#]ALIAS' $1_lbl.txt |\ + awk '{ + if (match($2,"\\$")==0){ + alias=$2; name =$3 + } + else{ + alias=$3; name =$2 + } + sub(",","__",alias); #Replace , + n=split(alias,a,"|"); + for (i=1; i<=n; i++) + print a[i] "\t" name; + } + END{ + print "###_END_OF_ALIAS_###" + }' >> $1_alias.txt