find question

Pete Holsberg pjh42 at pobox.com
Sat Jul 14 17:28:36 UTC 2007


Brian Fahrlander keyed the following on 7/14/2007 1:10 PM:

<snip>

>  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?

Try

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

-- 
Pete Holsberg
Columbus, NJ

He who asks a question is a fool for five minutes; he who does not ask a 
question remains a fool forever.
- Chinese Proverb





More information about the ubuntu-users mailing list