Overview
Comment:Three argument generic version
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 54ad18f1039645944e90f8559e05e0318caec69237873889c4daa683df9dd816
User & Date: gawthrop@users.sourceforge.net on 2000-10-17 12:24:02
Other Links: branch diff | manifest | tags
Context
2000-10-17
12:33:13
Added mtt_mod to the zapped list check-in: 91e45392f0 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
12:24:02
Three argument generic version check-in: 54ad18f103 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
11:07:59
*** empty log message *** check-in: 03b31bcedc user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/trans/dat22dat from [94c06f0f82] to [ba08d67a1d].

10
11
12
13
14
15
16




17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# Copyright (c) P.J.Gawthrop 1999

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$




## Revision 1.8  2000/09/21 10:07:06  peterg
## Now correctely writes out the state into _odes.dat rep.
##
## Revision 1.7  2000/04/06 09:02:46  peterg
## Removed bash let commands as unsupported by sh
## Do arithmetic within awk - yuk
##
## Revision 1.6  2000/04/06 08:36:15  peterg
## *** empty log message ***
##
## Revision 1.5  1999/03/15 22:42:52  peterg
## Strip comments (put in by Octave save function)
##
## Revision 1.4  1999/03/15 21:55:36  peterg
## Does away with the # symbol in the file - uses _de to get Nx Ny
## instead
##
###############################################################
if [ -z "$1" ]; then
  echo "Usage: dat22dat system odeso|odes"
  exit
fi

# Find Nx and Ny
Nx=`mtt_getsize $1 x` # States
Ny=`mtt_getsize $1 y` # Outputs

case $2 in
    odeso)
	First=1; Last=`expr $First + $Ny`
	;;
    odes)
	First=`expr $Ny + 2`; Last=`expr $First + $Nx`
	;;
    *)
	First=1; Last=`expr $Ny + 1`
        ;;
esac

echo Creating $1_$2.dat

awk '{
      ## Extract the data
      if (index($1,"#") != 1){
        for (i=First;i<=Last;i++)
	  printf("%s ", $i);
      printf("\n"); 
  }
}' First=$First Last=$Last <$1_odes.dat2  > $1_$2.dat







>
>
>
>



















|







|
|


|







|








|
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# Copyright (c) P.J.Gawthrop 1999

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.9  2000/09/27 16:12:50  peterg
## Use expr to evaluate arithmetic - compatible with sh (as opposed to
## bash)
##
## Revision 1.8  2000/09/21 10:07:06  peterg
## Now correctely writes out the state into _odes.dat rep.
##
## Revision 1.7  2000/04/06 09:02:46  peterg
## Removed bash let commands as unsupported by sh
## Do arithmetic within awk - yuk
##
## Revision 1.6  2000/04/06 08:36:15  peterg
## *** empty log message ***
##
## Revision 1.5  1999/03/15 22:42:52  peterg
## Strip comments (put in by Octave save function)
##
## Revision 1.4  1999/03/15 21:55:36  peterg
## Does away with the # symbol in the file - uses _de to get Nx Ny
## instead
##
###############################################################
if [ -z "$1" ]; then
  echo "Usage: dat22dat system ode|odes so|s"
  exit
fi

# Find Nx and Ny
Nx=`mtt_getsize $1 x` # States
Ny=`mtt_getsize $1 y` # Outputs

case $3 in
    so)
	First=1; Last=`expr $First + $Ny`
	;;
    s)
	First=`expr $Ny + 2`; Last=`expr $First + $Nx`
	;;
    *)
	First=1; Last=`expr $Ny + 1`
        ;;
esac

echo Creating $1_$2$3.dat

awk '{
      ## Extract the data
      if (index($1,"#") != 1){
        for (i=First;i<=Last;i++)
	  printf("%s ", $i);
      printf("\n"); 
  }
}' First=$First Last=$Last <$1_$2s.dat2  > $1_$2$3.dat


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