File mtt/bin/trans/dat2siag artifact ce0ee2cbb1 part of check-in a8cce33cfa


#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: dat2siag
# Converts data to siag (scheme in a grid) format - ie columns become rows.

# Data file dat to sdat conversion
# P.J.Gawthrop February 1998
# Copyright (c) P.J.Gawthrop, 1998.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.1  2001/04/16 22:22:06  geraint
## *** empty log message ***
##
## Revision 1.1  1999/03/29 03:35:13  peterg
## Initial revision
##
###############################################################




# This is the main transformation using awk
gawk '{
    i++
    for (j=1;j<=NF;j++)
	data[i,j]=$j;
    Cols=NF;
    Rows++;
}
END{
    for (j=1;j<=Cols;j++) {
	for (i=1;i<=Rows;i++){
	    printf("%s ", data[i,j]);
	}
	printf("\n");
    }
}'




MTT: Model Transformation Tools
GitHub | SourceHut | Sourceforge | Fossil RSS ]