help-bash
[Top][All Lists]
Advanced

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

Re: Check if file size greater than a small number?


From: Kerin Millar
Subject: Re: Check if file size greater than a small number?
Date: Thu, 10 Mar 2022 02:20:14 +0000

On Thu, 10 Mar 2022 03:02:57 +0100
Alex fxmbsw7 Ratchev <fxmbsw7@gmail.com> wrote:

> mkdir ttt
> cd ttt
> 
> >0 ; printf 1 >1 ; printf 22 >22 ; printf 333 >3
> 
> minsize() { < <( LC_ALL=C find "${@:2}" -maxdepth 0  -printf %s\\n ) gawk
> -v min=$1 'BEGIN { while ( getline <"/dev/stdin" ) if ( ++i && $0 <= min )
> print ARGV[i] ; exit }' "${@:2}" ; }
> 
> minsize 2 *

Use the stat() function that gawk already supports.

https://www.gnu.org/software/gawk/manual/html_node/Internal-File-Description.html

-- 
Kerin Millar



reply via email to

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