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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

file size

Status
Not open for further replies.

ogniemi

Technical User
Nov 7, 2003
1,041
PL
what is the simplest way to check/test file size?
(not using ls, istat, cksum - commands)

I need the shortest way to use it the script...

[ `....` -gt 724387 ] && .....

regards, m.
 
Try something like this
[ `wc -c $file` -gt 724387 ] && .....


Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
wc also displays the file name which must be removed
[tt]
[ `wc -c $file|awk '{print $1}'` -gt 724387 ] & ....
[/tt]

Jean Pierre.
 
Alas, it will not work. At least "cut" or "awk" have to be used...

# wc -c smit.log
2134511 smit.log

[ `wc -c smit.log|awk '{print $1}'` -gt 724387 ] && .....


do you know something shorter...?

thx.
 
Try something like this
[ `wc -c [highlight]<[/highlight]$file` -gt 724387 ] && .....

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top