Problem with "find" and "grep" command

I want to list all files/lines which except those which contain the pattern ' /proc/' OR ' /sys/' (mind the leading blank).

In a first approach I coded:

  find / -exec ls -ld {} | grep -v ' /proc/| /sys/' \; > /tmp/list.txt
 

But this doesn't work. I got an error (under Ubuntu):
grep: ;: No such file or directory
find: missing argument to `-exec'

What's wrong?

Peter

find / -exec ls -ld {} \; | grep -v ' /proc/| /sys/' > /tmp/list.txt

Your backslash was not at the right place...And you need a space before...

Addendum...
Thinking of it you are going to be in trouble for your are reading /proc and /sys anyway before the grep and I cant see the system say nothing...
In other words wrong logic, think again!

Ok, thank you. However your solution does NOT work.
The final list contains lots of files beginning with /sys/
So I think the grep filtering does not work this way.
Maybe the grep is wrong.
Any other suggestion?

Peter

try with this ..

$ find / -type d -print | egrep -v "/proc|/sys"
find . -type d \( -name "\\proc" -o -name "\\sys" \)

Ok, thank you.

BUT: I want to find files (so it must be -type f) AND
your egrep filter suppresses also files with pathes where /sys or /proc appears in the mid like

/usr/aaa/proc/dummy.log

or

/tmp/sys/anotherfile.txt

How could I apply your egrep filter ONLY to the beginning of the line?

$ find / -type f -print | egrep -v '^/proc|^/sys'

...does not work