[lug] find command or similar

Ed Hill ed at eh3.com
Tue May 13 11:27:54 MDT 2003


On Tue, 2003-05-13 at 11:19, Kenneth D. Weinert wrote:
> Here's a little shell script that should do the trick. I use locate
> because it's faster, but it could be replaced with:
> 
> find / -type f -print
> 
> locate \* | while read path;do
>   file=$(basename $path); 
>   res=$(echo $file | egrep "[[:alnum:]]{10,15}"); 
>   if [ ! -z $res ];then 
>     echo $path;
>   fi;
> done
> 
> Where I have {10,15} you could put {200,} for your first case and
> {200.240} for your second.
> 
> Note that the [[:alnum;]] expression might not match all filenames -
> you can do a "man egrep" and look at the regular expression syntax to
> make it more closely conform to what you might find on your system.


Not only is:

  find . -name '*' -depth -printf "%f\n" | egrep '.{201,}'

a "one-liner" but it overcomes the pattern-matching problems mentioned
above.

Heh, I win.  ;-)

Ed

-- 
Edward H. Hill III, PhD 
Post-Doctoral Researcher
Division of ESE, Colorado School of Mines, Golden, CO 80401
Email: ed at eh3.com  ehill at mines.edu
Phone: 303-273-3483
URLs:  http://cesep.mines.edu/people/hill.htm  http://eh3.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.lug.boulder.co.us/pipermail/lug/attachments/20030513/b8d74c1a/attachment.pgp>


More information about the LUG mailing list