[opensuse] limiting output from find <dir> ?
Does anyone know of a way of limiting output from "find" which doesn't involve looking up the entire directory and piping through head etc ? Not what I want: find <dir> -type f | head -1000 I was hoping for something like this: find <dir> -type f -n 1000 "-n 1000" = give me only the first 1000 names. -- Per Jessen, Zürich (4.9°C) http://www.hostsuisse.com/ - virtual servers, made in Switzerland. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 10/15/2015 09:40 AM, Per Jessen wrote:
Does anyone know of a way of limiting output from "find" which doesn't involve looking up the entire directory and piping through head etc ?
Not what I want: find <dir> -type f | head -1000
I was hoping for something like this:
find <dir> -type f -n 1000
"-n 1000" = give me only the first 1000 names.
There's nothing wrong with limiting via "|head", as find(1) will immediately stop traversing the directories when it receives EPIPE. Another remark: "head -NUM" is highly deprecated; use "head -nNUM" instead. Have a nice day, Berny -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Bernhard Voelker wrote:
On 10/15/2015 09:40 AM, Per Jessen wrote:
Does anyone know of a way of limiting output from "find" which doesn't involve looking up the entire directory and piping through head etc ?
Not what I want: find <dir> -type f | head -1000
I was hoping for something like this:
find <dir> -type f -n 1000
"-n 1000" = give me only the first 1000 names.
There's nothing wrong with limiting via "|head", as find(1) will immediately stop traversing the directories when it receives EPIPE.
Ah, I wasn't aware of that, I'll have to double check. Thanks Berny. -- Per Jessen, Zürich (6.4°C) http://www.hostsuisse.com/ - virtual servers, made in Switzerland. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
participants (2)
-
Bernhard Voelker
-
Per Jessen