On Tue, 13 Nov 2001, dave brett wrote:
> This command works the way I want it too:
> find / -type d -maxdepth 1
>
> This does not
> find / -type d -maxdepth 1 -exec du {} \;
> It gave the size of all directories.
That's what it's supposed to do... Try:
find / -type d -maxdepth 1 -exec du -s {} \;
I think that's what you're trying to do.
> find / -type d -maxdepth 1 -exec du {} \; |grep "\/[a-z,A-Z,0-9]^[\/]
>
> The pattern matching did not work the way I expected it to. What I wanted
> was it to reject all lines with a second "/".
I think you want this:
find / -type d -maxdepth 1 -exec du {} \; | egrep -v "/[^/]*/"
If you're trying to ignore certain lines, then use "grep -v" for lines
that don't match the pattern. It's much easier than trying to craft a
regex that won't match the lines you don't want in this case, since that
would look something like this:
find / -type d -maxdepth 1 -exec du {} \; | \
egrep "^[:digit:]*[:space:]*/[^/]*$"
In this case, the regex must encompass the whole of the line, and define
every aspect of what is acceptable.
> Would somebody please point me in the direction for finding out how
> pattern matching works.
Pick up any book on perl, or see any online tutorial on the language.
Since regular expressions are considered the "core" of the language, they
get a lot of attention and are explained very well to Perl programmers.
--
If I had a dollar for every brain that you don't have,
I'd have one dollar. - Squidward to SpongeBob
_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list