sum in df command


 
Thread Tools Search this Thread
Special Forums Hardware Filesystems, Disks and Memory sum in df command
# 1  
Old 08-01-2007
sum in df command

Hi,
os is TRU64.
When i type df -h , i get info about usage of my filesystems in MB and in GB.
Is there some command that i could use so to get sum of all used space on all filesystems ?
thanks.
# 2  
Old 08-01-2007
Hi Buddy,

u can try the command as below

df -h|awk '{s+=$3} END {print s}'

here $3 is the 3rd column of df -h output. If u want to get sum of any other column just type $<column number> for that column
# 3  
Old 08-01-2007
Max thank you very much.
That is exactly what i needed.
As i found this command very usefull ,
could you pleace point me to some site or book where i could learn such
tips&tricks :-)
# 4  
Old 08-01-2007
No dear,

I dont know any such books...but u can ask these things to this forum....people will help you...

Good that u found the command useful....

Read about awk and nawk filters....they are really useful....
# 5  
Old 08-01-2007
thanks max
, i' ll give a look on those filters
and stop by here when seeking for more knowledge about managing unix/linux systems.
cheers ,
Toni Smilie
# 6  
Old 08-01-2007
ya happy learning.....dear...u may mail me for questions on email id removed by moderator

I ll try best to answer.

Last edited by blowtorch; 08-01-2007 at 06:24 AM.. Reason: remove email id
# 7  
Old 08-01-2007
Please do not post your email id on the forums. This is against the rules and also a privacy risk.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to get the sum?

hi Gurus, I have an extract as seen below: INPUT 2015-08-24 15:00:00.0 |TCSERVER01 |ServiceEventHandler |2283 2015-08-24 15:01:00.0 |TCSERVER01 |ServiceEventHandler |576 2015-08-24 15:02:00.0 |TCSERVER01 |ServiceEventHandler |833 2015-08-24 15:03:00.0 |TCSERVER01 |ServiceEventHandler... (6 Replies)
Discussion started by: reignangel2003
6 Replies

2. Shell Programming and Scripting

Need to sum up a column value from multiple files into Credit and Debit categories using awk command

i have multiple files with Batch Header, Record detail & Batch trailer data in the files like : BH 20150225950050N8262 RD 20140918000000 99999999 unk Deferred Settlement -13950 BT01 -13950 *Above sample data donot have the spaces coorectly defined. I do have multiple batch trailer... (1 Reply)
Discussion started by: kcdg859
1 Replies

3. Shell Programming and Scripting

awk and or sed command to sum the value in repeating tags in a XML

I have a XML in which <Amt Ccy="EUR">3.1</Amt> tag repeats. This is under another tag <Main>. I need to sum all the values of <Amt Ccy=""> (Ccy may vary) coming under <Main> using awk and or sed command. can some help? Sample looks like below <root> <Main> ... (6 Replies)
Discussion started by: bk_12345
6 Replies

4. Shell Programming and Scripting

How to sum these value.

Hi, Unix Gurus, I need sum values from a file. file format like: 0004004 0000817 0045000 0045000 0045000 0045000 0045000 0045000 0045000 0045000 0045000 0045000 0004406 the result should be 459227 (817+45000 ... + 4406) anybody can help me out (7 Replies)
Discussion started by: ken002
7 Replies

5. UNIX for Dummies Questions & Answers

Getting the sum

I am trying to get the sum of the first column of a file. When I use the same method for other files it works just fine... for some reason for the file below it gives me an error that I don't understand... I tried looking at different lines of the file and tried different things, but I still... (7 Replies)
Discussion started by: cosmologist
7 Replies

6. Solaris

How to Sum

Hi I need to incorporate a 'sum' as follows into a script and not sure how. I have a variable per line and I need them to be summed, e.g below 1 23 1,456 1 1 34 46 How do I calculate the sum of all these numbers to ouptut the answer ( 1,562) Thanks in advance (3 Replies)
Discussion started by: rob171171
3 Replies

7. Shell Programming and Scripting

How to sum 2 files?

i have arq1.txt , like this: 1 2 3 4 5 and another arq2.txt 1 2 3 4 5 how to make this: 2 4 (8 Replies)
Discussion started by: beandj
8 Replies

8. Shell Programming and Scripting

Print sum and relative value of the sum

Hi i data looks like this: student 1 Subject1 45 55 Subject2 44 55 Subject3 33 44 // student 2 Subject1 45 55 Subject2 44 55 Subject3 33 44 i would like to sum $2, $3 (marks) and divide each entry in $2 and $3 with their respective sums and print for each student as $4 and... (2 Replies)
Discussion started by: saint2006
2 Replies

9. Shell Programming and Scripting

Sum with awk

Hi,consider this fields, $1 $2 $3 981 0 1 984 0 4 985 1 0 987 0 2 990 0 0 993 0 3 995 2 0 996 0 1 999 0 4 for each occurence of zero in column $2 and $3 I need to sum $1 fields, so for example, in this piece of code the result of $1 is 8910. I'm sure... (2 Replies)
Discussion started by: cv313x
2 Replies

10. Shell Programming and Scripting

sum

Hello everyone I need to write a script that sums numbers passed to it as arguments on the command line and displays the results. I must use a for loop and then rewrite it using a while loop. It would have to output something like 10+20+30=60 this is what I have so far fafountain@hfc:~$ vi sum... (1 Reply)
Discussion started by: Blinky85
1 Replies
Login or Register to Ask a Question