简体   繁体   中英

Bash / Awk. Where do i put the IF-statement?

I'm in need of a bash script with awk to find files less than a certain size ie 500KB and list these but can't seem to get an if-statement to work with this.

The following code outputs the files but all files and not the ones with a size less than said size.

#!/bin/sh
set `date`
ls -l -R |
awk "BEGIN { m = \"$2\"; d = $3 }
\$6 == m && \$7 == d && \$8 ~ /:/ {print}"

Where should I put the IF-Statement?

您可以为此使用find

find . -type f -size -500K

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM