![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Sort by size, then list file in each directory | ChatPerdu | UNIX for Dummies Questions & Answers | 3 | 07-01-2009 06:10 PM |
| How to list a file size, but not its name? | ordano | UNIX for Dummies Questions & Answers | 2 | 02-12-2009 02:00 AM |
| command to list file size | rgordon | HP-UX | 3 | 12-05-2007 05:43 AM |
| List File size | komputersman | UNIX for Dummies Questions & Answers | 10 | 06-13-2007 05:39 PM |
| list file within selected of day | happyv | Shell Programming and Scripting | 1 | 11-15-2006 04:47 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
want to add the size of the selected list of file
i have a files in the dir as below.
ls -lR ./.snapshot 5649600512 ./.snapshot/backup/data20080707 6006923264 ./.snapshot/backup/data20080708 5321129984 ./.snapshot/backup/data20080709 6686597120 ./.snapshot/backup/data20080710 7312855040 ./.snapshot/backup/data20080711 6115131392 ./.snapshot/backup/data20080714 7423959040 ./.snapshot/backup/data20080715 5940617216 ./.snapshot/backup/data20080716 6156181504 ./.snapshot/backup/data 4912037888 ./.snapshot/backup/data20080718 4528926720 ./.snapshot/backup/data20080721 i want to add the first column ( unsing awk or anything )and want to see the total number of bytes for that ls -lR ./.snapshot |
|
||||
|
To keep the forums high quality for all users, please take the time to format your posts correctly.
Thank You. The UNIX and Linux Forums Reply With Quote Code:
ls -lR ./.snapshot | awk '{t+=$1}1END{print t}'
|
|
||||
|
sorry i wrongly posted..
it is like du -b ./.snapshot 5649600512 ./.snapshot/backup/data20080707 6006923264 ./.snapshot/backup/data20080708 5321129984 ./.snapshot/backup/data20080709 6686597120 ./.snapshot/backup/data20080710 7312855040 ./.snapshot/backup/data20080711 6115131392 ./.snapshot/backup/data20080714 7423959040 ./.snapshot/backup/data20080715 5940617216 ./.snapshot/backup/data20080716 6156181504 ./.snapshot/backup/data 4912037888 ./.snapshot/backup/data20080718 4528926720 ./.snapshot/backup/data20080721 i want to add the column one which is size i want result like 5649600512 + 6006923264 ....etc in the result du -b ./.snapshot | awk '{print $1}' | ( here i want to add the whole column of data ) |
|
||||
|
Again ![]() Please read the Forum Rules & Guidelines, edit your post and add [code] tags Next read the replies very carefully. Code:
# du -b ./.snapshot | awk '{t+=$1}1END{print t}' f1
5649600512 ./.snapshot/backup/data20080707
6006923264 ./.snapshot/backup/data20080708
5321129984 ./.snapshot/backup/data20080709
6686597120 ./.snapshot/backup/data20080710
7312855040 ./.snapshot/backup/data20080711
6115131392 ./.snapshot/backup/data20080714
7423959040 ./.snapshot/backup/data20080715
5940617216 ./.snapshot/backup/data20080716
6156181504 ./.snapshot/backup/data
4912037888 ./.snapshot/backup/data20080718
4528926720 ./.snapshot/backup/data20080721
66053959680
Last edited by danmero; 09-28-2009 at 03:31 PM.. Reason: Fix typo, thanks c |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|