Sponsored Content
Full Discussion: need help du -sk
Top Forums UNIX for Dummies Questions & Answers need help du -sk Post 302097266 by arunkumar_mca on Wednesday 22nd of November 2006 11:58:57 PM
Old 11-23-2006
Quote:
Originally Posted by grial
Sure!
Code:
... awk '{count+=$1; print}END {print "Total:  ",count,"kb"}'

I'm not an awk expert but here we go!
"count" is where the size is going to be contained.
In the first {}, for each line (result of du), count will increment by adding the first field value, represented by $1 (by default fields are separated by spaces and/or tabs). In this case, the first field is the size of the folder. And print the whole line.
Finally, in the second {}, the result is shown.
Regards.

Grial thanks for your explanation and very great of you .. Please let me know why we are using print here "{count+=$1; print}" . please let me know the use of print here if we didnt use print here is it right ?? .Let me know ,also with that i am new to AWK...

Thanks in advance,
Arun kumar
 
PQSTAT(1)							      pqstat								 PQSTAT(1)

NAME
pqstat - List jobs in NetWare print queue SYNOPSIS
pqstat [ -h ] [ -S server ] [ -U user name ] [ -P password | -n ] [ -C ] queue name [ job count ] DESCRIPTION
pqstat lists specified number of jobs from the specified NetWare print queue available to you on some server. If you are already connected to some server, this one is used. If pqstat does not print to a tty, the decorative header line is not printed, so that you can count the jobs in print queue by doing pqstat -S server queue | wc -l pqstat looks up the file $HOME/.nwclient to find a file server, a user name and possibly a password. See nwclient(5) for more information. Please note that the access permissions of .nwclient MUST be 600, for security reasons. OPTIONS
queue name queue name is used to specify queue. You can not use wildcards in the name. job count job count is used to specify how much entries will be shown. Default is to show all entries. -S server server is the name of the server you want to use. -U user name If the user name your NetWare administrator gave to you differs from your unix user-id, you should use -U to tell the server about your NetWare user name. -P password You may want to give the password required by the server on the command line. You should be careful about using passwords in scripts. -n -n should be given to mount shares which do not require a password to log in. If neither -n nor -P are given, pqstat prompts for a password. -C By default, passwords are converted to uppercase before they are sent to the server, because most servers require this. You can turn off this conversion by -C. SEE ALSO
nwclient(5), nprint(1), slist(1), ncpmount(8), ncpumount(8), pqlist(1), pqrm(1) CREDITS
pqstat was written by David Woodhouse (dave@imladris.demon.co.uk) pqstat 03/03/1998 PQSTAT(1)
All times are GMT -4. The time now is 05:45 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy