Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

List files if the file size has certain number of digit 1

Status
Not open for further replies.

new2unix

Programmer
Feb 5, 2001
143
US
Hi,

What other command should I pipe the output of "ls -lt" to in order to give me a list any files that have file size over certain number of digit in column 5?

-rw-r----- 1 user usergroup 3930314 Aug 08 14:59 File1.txt
-rw-r----- 1 user usergroup 33930314 Aug 08 14:59 File1.txt
-rw-r----- 1 user usergroup 777905 Aug 08 14:59 File2.txt

For example, for the above list, I only want to show the first two files since their file size has over or 7 digit.

Thanks,

Mike
 
Try

ls -l | awk "$5>999999" CaKiwi
 
Thanks, CaKiwi. Your suggestion gave me a good place to start.

I got the following error when using the double-quotation with awk on my AIX:

Syntax Error The source line is 1.
The error context is
>>> > <<< 999999
awk: 0602-500 Quitting The source line is 1.

When I used the single-quote, it gave the desired result.

Thanks again.


Mike
 
Right, you have to use single quotes to protect the $ from the shell. I ran it under a dos version of awk and so didn't have that problem. CaKiwi
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top