find question

Brian Fahrlander brian at fahrlander.net
Sat Jul 14 17:10:07 UTC 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

H.S. wrote:
> Pete Holsberg wrote:
[snipped]

>> Interesting! I used
>>
>> find / -name proc -prune -o -name .profile 2>/dev/null
>>
>> It did not run down the entire /proc hierarchy but it did report all 
>> files with "proc" in their names, such as all the stuff under 
>> /usr/src/linux-headers* !!
>>
>>
> 
> Try:
> $> find / -path './proc' -prune -o -name .profile 2>/dev/null
> 
> This if from the command I tried to search for *gz files in the current
> directory's tree but excluding directory named dat:
> $> find ./ -path  './dat'  -prune -o  -name "*gz"  -print

    OK, I'm intrigued; I'm also working on something.

    I'm searching a 1-wire filesystem looking for devices that have
names like "[0-9A-F][0-9A-F]\.[0-9A-F]*".

    The problem is, I need to skip paths with "uncached" "alarm" and
"bus.0" in their names.  And the examples I'm seeing aren't getting me
there.  Either they leave behind the directory name (until -path) or
other things start showing up.

   Like this:
find /var/1wire -path './bus.0' -prune -o -name
"[0-9A-F][0-0A-F]\.[[0-9A-F]*" 2>/dev/null

    Returns:
/var/1wire/bus.0/1F.38C704000000
/var/1wire/bus.0/1F.B9C604000000
/var/1wire/bus.0/1F.1DBC04000000
/var/1wire/bus.0/1F.1DBC04000000/main/10.BB434D010800
/var/1wire/bus.0/1F.1DBC04000000/main/alarm/10.BB434D010800
/var/1wire/uncached/bus.0/1F.38C704000000
/var/1wire/uncached/bus.0/1F.B9C604000000
/var/1wire/uncached/bus.0/1F.1DBC04000000
/var/1wire/uncached/bus.0/1F.1DBC04000000/main/10.BB434D010800
/var/1wire/uncached/bus.0/1F.1DBC04000000/main/alarm/10.BB434D010800
/var/1wire/uncached/1F.38C704000000
/var/1wire/uncached/1F.B9C604000000
/var/1wire/uncached/1F.1DBC04000000
/var/1wire/uncached/1F.1DBC04000000/main/10.BB434D010800
/var/1wire/uncached/1F.1DBC04000000/main/alarm/10.BB434D010800
/var/1wire/1F.38C704000000
/var/1wire/1F.B9C604000000
/var/1wire/1F.1DBC04000000
/var/1wire/1F.1DBC04000000/main/10.BB434D010800
/var/1wire/1F.1DBC04000000/main/alarm/10.BB434D010800

   Notice the "bus.0" still shows up.  What am I doing wrong?
- --
 ------------------------------------------------------------------------
 Brian Fahrländer                 Christian, Conservative, and Technomad
 Evansville, IN                              http://Fahrlander.net/brian
 ICQ: 5119262                         AOL/Yahoo/GoogleTalk: WheelDweller
 ------------------------------------------------------------------------
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGmQNu6PLtRzZbdhYRAlIbAJ4/ePRQx/t/RpfNiUrhS3k+VHMTCQCfclpu
FWC5eltwZppJzfzsPxV1si0=
=4VLo
-----END PGP SIGNATURE-----




More information about the ubuntu-users mailing list