|
The reason why this doesn't work is simple: in "ls -l $DIR | grep ..." the grep works on the output of ls, not on the files named in this output.
Note, that getting the diskspace and grepping for some content are two entirely different functions. Therefore you could do it only by performing these two different functions on every file and binding together the output of these via a script.
Having said this: use "find" ("man find") to set up a loop and use the "-exec" clause of "find" to 1.) grep the file for the content you are interested in and 2.) use "du" to get the filesize. 3.) Print out both if the grep has found the content, else do nothing. This will give you a list of filenames and -sizes.
I hope this helps.
bakunin
|