bug-findutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to search for files that have fewer than n lines?


From: Peng Yu
Subject: Re: How to search for files that have fewer than n lines?
Date: Fri, 1 Jan 2010 13:18:06 -0600

On Thu, Dec 31, 2009 at 9:23 PM, James Youngman <address@hidden> wrote:
> On Thu, Dec 31, 2009 at 10:05 PM, Peng Yu <address@hidden> wrote:
>> I know I can used wc -l to get the number of lines in a file. Could
>> somebody let me know how to search for files that have fewer than n
>> lines? (n is a number)
>
> min=73 # or whatever minimum you like.
> find . -type f -print0 | xargs -r -0 wc -l /dev/null | awk -vn="$min"
> '$2 != "/dev/null" && $2 != "total" && $1 < n {print $2;}'
>
> The thing with the "/dev/null" there is to ensure that wc will always
> print the filename (which it won't if there is always one argument) by
> ensuring that wc is always passed more than one argument.

This looks complicate for me to read. In order for me to understand
how the above command does the job, do you have brief introductory
material for findutils?




reply via email to

[Prev in Thread] Current Thread [Next in Thread]