Hello Friends,
Im calculating file sizes with below AWK script. I do this before some spesific files are transferred. I run the script it works but after several running it stuck with a limit of 2147483647 (2 Gbytes -1 byte) and cant exceed this. Something is wrong and I can't proceed, would appreciate any help.
find . \( -name "*.gz" -o -name "*.tar" -o -name "*.rar" \) -mtime +1 -exec ls -l {} \;| awk '/^-/ {a[$6 OFS sprintf("%2d",$7)]+=$5} END {for(i in a) printf "%s %15d %6s\n",i,a,"Bytes"}' >> sum_of_files.txt
SUM=`awk '{a+=$3}END{printf "%15d\n",a}' sum_of_files.txt`
i find .gz, .tar or .rar files which are older than 1 day under a main directory and execute "ls -l" and calculate sizes but i also print 6th and 7th columns too into same file just for info.Then using 3rd colums i calculate the all sizes as a total sum.
sum_of_files.txt
Sep 4 416192512 Bytes
Sep 4 416192512 Bytes
Sep 4 416192512 Bytes
Sep 4 416192512 Bytes
Sep 4 416192512 Bytes
Sep 4 416192512 Bytes
Sep 4 416192512 Bytes
Sep 4 416192512 Bytes
The output of script is like below (sum of bytes above file) :
server{root}>./size.sh
416192512 # this is size of compressed folder only it is calculated #
server{root}>./size.sh
832385024
server{root}>./size.sh
1248577536
server{root}>./size.sh
1664770048
server{root}>./size.sh
2080962560
server{root}>./size.sh
2147483647
server{root}>./size.sh
2147483647
server{root}>./size.sh
2147483647
---------- Post updated at 05:12 PM ---------- Previous update was at 03:41 PM ----------
I'm afraid my system does not support 64 bits of aritmethic operations
root@SL02 # file `which bc` `which awk` `which perl`
/usr/bin/bc: ELF 32-bit MSB executable SPARC Version 1, dynamically linked, stripped
/usr/bin/awk: ELF 32-bit MSB executable SPARC Version 1, dynamically linked, stripped
/usr/bin/perl: ELF 32-bit MSB executable SPARC Version 1, dynamically linked, stripped
Please advise, is my system unsufficient for such aritmethic operations and should i upgrade the solaris version to 64-Bit exec SPARC?
thanks by advanced