Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Unix script newbie

Unix script newbie

From: sonia pajerowski <spajerowski_at_yahoo.com>
Date: Tue, 7 Nov 2000 11:06:42 -0800 (PST)
Message-Id: <10673.121342@fatcity.com>


Hello Everyone,
I am newbie to unix. I am trying to write a script where all the files starting with BUSH_ will change to GORE_ or vice-versa (Depending upon the election results).
I am not sure what the format will be after BUSH_ or GORE_.
This is what I have

#!/bin/ksh

if [ $# -ne 2 ];
then
 echo "Error - Incorrect number of parameters passed"  exit 2
fi

LVAR=$1 (# will be passed BUSH_ or GORE_) WVAR=$2 (# will be passed BUSH_ or GORE_)

WINDIR='/export/home/oracle/scripts/WIN' LOSEDIR='/export/home/oracle/scripts/LOSE'

for file in $LVAR[*] # wild card does not work do
 if [ -f $file ];
 then
#cp $WIG1DIR/$file $WIG2DIR/B_$file
#copy all files starting with BUSH_xxxx to GORE_xxxx
# where xxxx is rest of the string.

  echo "$file is backed up in $WINDIR"
 fi
done
I am not able to find any substring or mid function to strip the filename and append with the rest of the string.
Will really appreciate if some unix expert canhelp me out.

Thanks for your help.
Sonia P.



Do You Yahoo!?
Thousands of Stores. Millions of Products. All in one Place. Received on Tue Nov 07 2000 - 13:06:42 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US