Re: An appropriate directory search tool?
On Fri 19 Oct 2018 at 10:00:25 (-0500), Richard Owlett wrote:
> The "MATE Search Tool" comes close.
>
> It can:
> Select a starting directory.
> Search for a specific extension.
> Search for a keyword in file content.
>
> It cannot:
> Search ONLY the specified directory.
> Return files that DO NOT contain a keyword.
>
> I suspect what I want would most likely be what I'm looking for.
> "ls" can search by extension and stay in specified directory.
> It cannot include/exclude keywords.
>
> My immediate problem involves only a couple dozen files so manual
> search is feasible.
Recalling https://lists.debian.org/debian-user/2018/09/msg00228.html
as others have said, get familiar with find.
I keep a number of potted searches for different occasions as the
syntax can be a bit overwhelming. Here are a few:
find . -type f | while read file ; do bash-function "$file"; done # avoid using exec
find . -type f -exec chmod a-wx {} \;
find . -type f -size 1234c -print | less # size in bytes
find . -type f -mmin -1440 -print | less # one day
find . -type f -exec file {} \; | less
find . -type f -name \*ly -printf '%TY-%Tm-%Td %TT %f\n' | cut --complement -b 20-30 | sort
find . -type f -name \*ly -exec grep -Z -l -i 'x' {} \; | sort -z | xargs -0 less # display files
find . -type f -name \*ly -exec grep -H -i 'x' {} \; | sort | less # display lines
Cheers,
David.
Reply to: