Overview
Comment:Removed bash let commands as unsupported by sh
Do arithmetic within awk - yuk
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 9a22e99aaece19edff19abf06cdd3235a3a9f66f216afdaea280a93254ff3aa3
User & Date: gawthrop@users.sourceforge.net on 2000-04-06 09:02:46.000
Other Links: branch diff | manifest | tags
Context
2000-04-06
10:52:53
Replace $PWD with `pwd` for sh compatibility check-in: 257a6a6598 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
09:02:46
Removed bash let commands as unsupported by sh
Do arithmetic within awk - yuk
check-in: 9a22e99aae user: gawthrop@users.sourceforge.net tags: origin/master, trunk
08:36:15
*** empty log message *** check-in: e4a01c329d user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes
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
# Copyright (c) P.J.Gawthrop 1999

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



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


# Find Nx and Ny
Nx=`grep "MTTNx " <$1_def.r | awk '{print $3}' | sed 's/;//'`
Ny=`grep "MTTNy " <$1_def.r | awk '{print $3}' | sed 's/;//'`

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

echo Creating $1_$2.dat

awk '{




  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

# Copyright (c) P.J.Gawthrop 1999

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## 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
##
###############################################################


# Find Nx and Ny
Nx=`grep "MTTNx " <$1_def.r | awk '{print $3}' | sed 's/;//'`
Ny=`grep "MTTNy " <$1_def.r | awk '{print $3}' | sed 's/;//'`

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

echo Creating $1_$2.dat

awk '{
      ## Convert to numbers
      split(First,F,"+"); First = F[1] + F[2]
      split(Last, L,"+"); Last  = L[1] + L[2]
      ## 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 ]