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

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

RE: Unix script newbie

From: <ddorr.cs_at_clearstream.com>
Date: Wed, 8 Nov 2000 13:28:19 +0100
Message-Id: <10674.121412@fatcity.com>


OK guys, here's how I would do it :

for file in BUSH_* ; do mv $file GORE_${file#BUSH_} ; done

and if you really want to use a script and positional params ( looser as $1 and winner as $2 ) :

for file in ${1}_* ; do mv $file ${2}_${file#$1_} ; done

> ----------
> From: Bill Conner[SMTP:bconner_at_verio.net]
> Reply To: ORACLE-L_at_fatcity.com
> Sent: Tuesday, November 07, 2000 22:33
> To: Multiple recipients of list ORACLE-L
> Subject: RE: Unix script newbie
>
> At 01:00 PM 11/7/00 -0800, Glenn Travis wrote:
> >Not so fast. Part of being active in a list is posting your findings.
> >Please share your success with the rest of us. Thanks!
>
> i would have to agree with this, i know i enjoy it when the findings
> are posted.
>
> -bill
>
>
> > > -----Original Message-----
> > > From: root_at_fatcity.com [mailto:root_at_fatcity.com]On Behalf Of sonia
> > > pajerowski
> > > Sent: Tuesday, November 07, 2000 3:05 PM
> > > To: Multiple recipients of list ORACLE-L
> > > Subject: Unix script newbie
> > >
> > >
> > > Ignore this message. I got it working
> > > Thanks
> > > Sonia P.
> > >
> > > 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.
> > > http://shopping.yahoo.com/
> > > --
> > > Please see the official ORACLE-L FAQ: http://www.orafaq.com
> > > --
> > > Author: sonia pajerowski
> > > INET: spajerowski_at_yahoo.com
> > >
> > > Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
> > > San Diego, California -- Public Internet access / Mailing Lists
> > > --------------------------------------------------------------------
> > > To REMOVE yourself from this mailing list, send an E-Mail message
> > > to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
> > > the message BODY, include a line containing: UNSUB ORACLE-L
> > > (or the name of mailing list you want to be removed from). You may
> > > also send the HELP command for other information (like subscribing).
> > >
> >
> >--
> >Please see the official ORACLE-L FAQ: http://www.orafaq.com
> >--
> >Author: Glenn Travis
> > INET: Glenn.Travis_at_wcom.com
> >
> >Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
> >San Diego, California -- Public Internet access / Mailing Lists
> >--------------------------------------------------------------------
> >To REMOVE yourself from this mailing list, send an E-Mail message
> >to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
> >the message BODY, include a line containing: UNSUB ORACLE-L
> >(or the name of mailing list you want to be removed from). You may
> >also send the HELP command for other information (like subscribing).
>
> --
> Please see the official ORACLE-L FAQ: http://www.orafaq.com
> --
> Author: Bill Conner
> INET: bconner_at_verio.net
>
> Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
> San Diego, California -- Public Internet access / Mailing Lists
> --------------------------------------------------------------------
> To REMOVE yourself from this mailing list, send an E-Mail message
> to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
> the message BODY, include a line containing: UNSUB ORACLE-L
> (or the name of mailing list you want to be removed from). You may
Received on Wed Nov 08 2000 - 06:28:19 CST

Original text of this message

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