awk sum

Need to work up the perl skills. Lots. But First ...

Perhaps two minutes with an awk .sh did the duct taping job just fine. Goal was to set up a bunch of tablespaces and this (not vendor neutral) ksh script works.

Maybe some day will fix the perl deficiency, or not, if something better comes along. But first ...



#!/usr/bin/ksh
# mk_tsttblspcs.sh
# generate DCL for lots of test tablespaces
# names test[0-3][0-9A-Z] for 144 of them
# set variable assignment "/foo/" value for your platform

awk -v PATH="/foo/" 'BEGIN {
  for ( i=48; i<52; i++ )
    for ( j=48; j<91; j++ )
      if ( ( j < 58 ) || ( j > 64 )) {
        printf("create tablespace test%c%c ", i, j);
        printf(" datafile \047%stest%c%c.dbf\047 size 1M;\n",PATH, i, j);
      }
}'

#eof: mk_tsttblspcs.sh


No comments:

Post a Comment