Sponsored Content
Full Discussion: Function SUM SIZE
Top Forums Shell Programming and Scripting Function SUM SIZE Post 302338973 by johnbach on Wednesday 29th of July 2009 11:18:29 AM
Old 07-29-2009
Code:
fns()
{
arr[0]=KB
arr[1]=MB
arr[2]="GB"
arr[3]="TB"

   sz=$1
   ctr=0;
   while [ sz -gt 1023 ]
      do
         ((sz=$sz /1024.0))
         ((ctr=$ctr +1))
      done
   echo "Size="$sz" "${arr[$ctr]};
}
fns $1

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Sum up files whose size Kbytes and Mbytes

Hello Friends, When i type du -sh *.jar | sort -n under a library directory i get a result similar below output: 1M 1.jar 2.4M 2.jar 4.5M 3.jar . . . . . . 1K (n-2).jar 15K (n-1).jar 77.7K n.jar I want to sum up the size... (1 Reply)
Discussion started by: EAGL€
1 Replies

2. Shell Programming and Scripting

How to traverse directory structure and sum size of files?

How do I write a bash or ruby or perl or groovy script to print all the files in my directory tree that are one-to-two years old, the size of each file, and the sum of file sizes and then delete them? I was using find . -atime +365 -exec rm '{}' \; but the problem was that I could not... (5 Replies)
Discussion started by: siegfried
5 Replies

3. Solaris

calculate sum size of files by date (arg list too long)

Hi, I wanted a script to find sum of files for a particular date, below is my script ls -lrt *.req | nawk '$6 == "Aug"' | nawk '$7 == "1"'| awk '{sum = sum + $5} END {print sum}' However, i get the error below /usr/bin/ls: arg list too long How do i fix that. Many thanks before. (2 Replies)
Discussion started by: beginningDBA
2 Replies

4. Shell Programming and Scripting

Sum of file size in directory / subdirectory

Hi , I am trying to write something to find the size of particular type of files in a directory & it's subdirectory and sum the size .. These types of file are found at directory level or its subdirectories level .. #!/bin/ksh FNAME='.pdf' S_PATH=/abc/def/xyz find $S_PATH -exec ls -lad... (4 Replies)
Discussion started by: Vaddadi
4 Replies

5. UNIX for Advanced & Expert Users

size for sum variable limitation on awk

Hello first, truth been told, I'm not even close to be advanced user. I'm posting here because maybe my question is complicated enough to need your expert help I need to use awk (or nawk - I don't have gawk) to validate some files by computing the total sum for a large numeric variable. It... (1 Reply)
Discussion started by: cwitarsa
1 Replies

6. Shell Programming and Scripting

[SOLVED] Awk one line to sum up a function

I need help with debugging an error in my awk script. I have a shell script with variable named U_new_i and want to pass it to awk for use in a summation. The original file have the following content. cat test.txt -2445.7132000000 -2444.9349000000 -2444.3295000000 -2443.1814000000 ... (0 Replies)
Discussion started by: Quantum_Dot
0 Replies

7. Shell Programming and Scripting

perl Image::size function

Hi, How to use Image::size function ? because I want to list all image thatare less than size pixels in horizontal resolution. so here is my code : #!/usr/bin/perl -w use Image::Size; use constant GIVEN_WIDTH = '100'; my @filtered_images = grep { my @d = imgsize( $_ ); $d < GIVEN_WIDTH }... (8 Replies)
Discussion started by: guidely
8 Replies

8. UNIX for Dummies Questions & Answers

How to get the set of files size as a sum in a directory.

Hi, Can someone help me to get the complete files size (sum) over a perod time (1 day,2days)in a directory. eg: Directory :ABC I have a1,a2,a3 files are created in last 24 hours so I need to get the some of all these files. I am using the below find command but its giving me the... (1 Reply)
Discussion started by: gaddamja
1 Replies

9. Shell Programming and Scripting

Script - SUM SIZE

Hello, I need help. I working a a script that will get back directory size. I am on linux. I am using du -sk to get the size of directories. But, as the script is launch under nagios, i need to find a work aound to get rid of time out issue due to the large amount of files in one of... (1 Reply)
Discussion started by: Aswex
1 Replies

10. UNIX for Dummies Questions & Answers

Sum function

I have file input China,Gaolian,9135774346294,AirAsia,0,0,0,0,0,0,0,0,0,0,0,0,0,0,165 India,Gangga,9135770291502,AirAsia,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3325 India,Nahdit,9135766545904,AirAsia,0,0,0,0,0,0,0,0,0,0,0,0,0,0,440 India,Kathman,9135768476591,AirAsia,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0... (5 Replies)
Discussion started by: radius
5 Replies
IPESCRIPT(1)						      General Commands Manual						      IPESCRIPT(1)

NAME
ipescript - Run an Ipe script (written in Lua) SYNOPSIS
ipescript script { arguments } DESCRIPTION
ipescript runs an Ipe script written in Lua. The Ipe bindings are automatically available in the script. Ipescript looks for the script in any of the script directories. The script argument should not contain the .lua extension. ENVIRONMENT VARIABLES
ipescript respects the following environment variables: IPELATEXDIR the directory where ipetoipe runs Pdflatex. IPESCRIPTS a list of directories where Ipescript will look for scripts. When this variable is not set, Ipe searches first the current directory, then ~/.ipe/scripts, and finally the system-wide Ipe script directory. When this variable is set, it should contain a list of directories, separated by semicolons. A single under- score is replaced by the system-wide Ipe script directory. IPEDEBUG set this to 1 for debugging output from ipescript. AUTHOR
Otfried Cheong REPORTING BUGS
Please report bugs using Ipe bugzilla at http://ipe7.sourceforge.net/bugzilla.html SEE ALSO
Ipe is documented fully in The Ipe Manual, which is available online at http://ipe7.sourceforge.net/manual/manual.html . August 28, 2011 IPESCRIPT(1)
All times are GMT -4. The time now is 04:37 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy