Re: Shell script: find

From: Renison, Rick (rick.renison_at_EDS.COM)
Date: 09/09/03

  • Next message: Stephen Firmes: "Moving users and print queues to another machine"
    Date:         Tue, 9 Sep 2003 15:10:42 -0400
    To: aix-l@Princeton.EDU
    
    

    Use "/somplace/.[!.]*" (dot followed by not dot)

    > -----Original Message-----
    > From: cbaker@GOODYEAR.COM [mailto:cbaker@GOODYEAR.COM]
    > Sent: September 9, 2003 2:35 PM
    > To: aix-l@Princeton.EDU
    > Subject: Re: Shell script: find
    > Importance: High
    >
    >
    > You do NOT want to do the "/someplace/.*" !!!! But rather
    > "/someplace/.[a-z,A-Z,0-9]*" or something of that nature.
    >
    > WHY?
    >
    > Because using a "/someplace/.*" in a find command will
    > traverse UP to "/"
    > since it will find "/someplace/.." (TWO DOTS). This can be VERY
    > DANGEROUS if you are doing, say a find and an rm (remote) of what you
    > found. You could end up removing files in far distant
    > directories or even
    > other filesystems.
    >
    > With the "[a-z]" or "[0-z]" that Mr. Thompson put forth, you are
    > restricting the search to any character after the first "."
    > but not another
    > "."
    >
    > Hope that helps,
    >
    > Christopher M. Baker
    > Senior Technical Support Analyst
    > DSE/TCO
    > Goodyear Tire and Rubber Company
    >
    > =================================================
    > Contains Confidential and/or Proprietary Information.
    > May not be copied or disseminated without the expressed
    > written consent of The Goodyear Tire & Rubber Company.
    > =================================================
    >
    >
    >
    >
    > Holger.VanKoll@S
    > WISSCOM.COM To:
    > aix-l@Princeton.EDU
    > Sent by: IBM AIX cc: (bcc:
    > Chris Baker/NA/GDYR)
    > Discussion List Subject: Re:
    > Shell script: find
    > <aix-l@Princeton
    > .EDU>
    >
    >
    > 09/09/2003 08:02
    > AM
    > Please respond
    > to IBM AIX
    > Discussion List
    >
    >
    >
    >
    >
    >
    > the point of using "something/*" is to avoid the command line
    > overflow.
    > this makes the shell not escaping it.
    > as I am sure you know this yourself, I am wondering if we´re
    > talking about
    > the same
    >
    > in any case its true that files starting with a dot wont be found. one
    > would have to use "/somewhere/*" "/somewhere/.*"
    >
    >
    > -----Original Message-----
    > From: Bill Thompson [mailto:bill.thompson@GOODYEAR.COM]
    > Sent: Tuesday, September 09, 2003 1:51 PM
    > To: aix-l@Princeton.EDU
    > Subject: Re: Shell script: find
    >
    >
    > "/some/path/*" is fine EXCEPT it will not find files that start with a
    > period (e.g.: ".profile") and it could overflow the command
    > line buffer if
    > there are lots of files in the directory. (just like "ls -l
    > *" can overflow
    > the command line buffer).
    >
    > Bill Thompson
    > Sr UNIX Systems Administrator
    > The Goodyear Tire & Rubber Co.
    >
    > Contains Confidential and/or Proprietary Information
    > May Not Be Copied or Disseminated Without Express Consent of
    > The Goodyear
    > Tire & Rubber Company.
    >
    > AIX-L Archives: http://marc.theaimsgroup.com/?l=aix-l&r=1&w=2
    >
    >
    > ----- Original Message -----
    > From: <Holger.VanKoll@SWISSCOM.COM>
    > Newsgroups: bit.listserv.aix-l
    > To: <aix-l@Princeton.EDU>
    > Sent: Tuesday, September 09, 2003 7:00 AM
    > Subject: Re: Shell script: find
    >
    > > > find /usr/lpp/* -prune
    > > > find /usr/lpp/.[0-z]* /usr/lpp/* -prune
    > > >Note that either of these could fail if you have too many files in
    > > >your
    > > path.
    > >
    > > it should be fine to use "/some/path/*" etc., shouldnt it? sorry, no
    > > time to test
    > >
    > >
    > > -----Original Message-----
    > > From: Bill Thompson [mailto:bill.thompson@GOODYEAR.COM]
    > > Sent: Tuesday, September 09, 2003 12:50 PM
    > > To: aix-l@Princeton.EDU
    > > Subject: Re: Shell script: find
    > >
    > >
    > > Rad,
    > >
    > > Let's say you were looking for all the stuff in /usr/lpp,
    > but none of
    > > the subdirectories. You could use the following notation:
    > >
    > > find /usr/lpp/* -prune
    > >
    > > If you wanted to find the "hidden" files as well (those
    > starting with
    > > a dot), this should work:
    > >
    > > find /usr/lpp/.[0-z]* /usr/lpp/* -prune
    > >
    > > Note that either of these could fail if you have too many files in
    > > your path.
    > >
    > > Another way to do it without using find:
    > >
    > > for FILE in $(ls /usr/lpp); do
    > > echo /usr/lpp/$FILE
    > > done
    > >
    > > HTH
    > >
    > > Bill Thompson
    > > Sr UNIX Systems Administrator
    > > The Goodyear Tire & Rubber Co.
    > >
    > > Contains Confidential and/or Proprietary Information
    > > May Not Be Copied or Disseminated Without Express Consent of The
    > > Goodyear Tire & Rubber Company.
    > >
    > > AIX-L Archives: http://marc.theaimsgroup.com/?l=aix-l&r=1&w=2
    > >
    > >
    > > ----- Original Message -----
    > > From: "Rioveros, Dario C." <riovdac@RSDEVT.INSULAR.COM.PH>
    > > Newsgroups: bit.listserv.aix-l
    > > To: <aix-l@Princeton.EDU>
    > > Sent: Monday, September 08, 2003 11:44 PM
    > > Subject: Shell script: find
    > >
    > > > Hi AIX people,
    > > >
    > > > I need a little help here. how can I find the
    > files only on
    > > > the
    > > indicated PATH
    > > > and will not search on its subdirectories. (non-recursive find).
    > > >
    > > > Thanks.
    > > > rad
    >


  • Next message: Stephen Firmes: "Moving users and print queues to another machine"

    Relevant Pages

    • Re: AIX and 2038?
      ... The issue lies ... Sr UNIX Systems Administrator ... The Goodyear Tire & Rubber Co. ... Tire & Rubber Company. ...
      (AIX-L)
    • Re: Shell script: find
      ... moving into other filesystems. ... > written consent of The Goodyear Tire & Rubber Company. ... > May Not Be Copied or Disseminated Without Express Consent of The Goodyear ...
      (AIX-L)
    • Re: Sessions failover
      ... Sr UNIX Systems Administrator ... The Goodyear Tire & Rubber Co. ... Tire & Rubber Company. ... Subject: Sessions failover ...
      (AIX-L)
    • 32-bit OS on 5.2
      ... Sr UNIX Systems Administrator ... The Goodyear Tire & Rubber Company ... Contains Confidential and/or Proprietary Information. ...
      (AIX-L)
    • Re: Multiple Routing Tables
      ... Sr UNIX Systems Administrator ... May Not Be Copied or Disseminated Without Express Consent of The Goodyear Tire & Rubber Company. ... > Q1) Actually i want to create multiple routing tables for AIX box. ...
      (AIX-L)