Overview
Comment:Use expr to evaluate arithmetic - compatible with sh (as opposed to
bash)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: d7c7b7b1cb63aabcccf12a593792a55bf94f25fae08aa599f634cdaf97cdad01
User & Date: gawthrop@users.sourceforge.net on 2000-09-27 16:12:50.000
Other Links: branch diff | manifest | tags
Context
2000-09-27
16:15:55
Now sh (as opposed to bash) compatible - fixed dat22dat again check-in: d4e4223ed3 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
16:12:50
Use expr to evaluate arithmetic - compatible with sh (as opposed to
bash)
check-in: d7c7b7b1cb user: gawthrop@users.sourceforge.net tags: origin/master, trunk
2000-09-21
10:10:22
Initial revision check-in: de93c3c4bc user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes
10
11
12
13
14
15
16



17
18
19
20
21
22
23
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26







+
+
+







# 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 ***
##
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
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







-
+


-
+


-
+


-
+











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

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

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

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