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.

  1. Use Code Tags when you post any code or data samples so others can easily read your code.
    You can easily do this by highlighting your code and then clicking on the # in the editing menu. (You can also type code tags and by hand.)
  2. Avoid adding color or different fonts and font size to your posts.
    Selective use of color to highlight a single word or phrase can be useful at times, but using color, in general, makes the forums harder to read, especially bright colors like red.
  3. Be careful when you cut-and-paste, edit any odd characters and make sure all links are working property.

Thank You.

The UNIX and Linux Forums
Reply With Quote

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 :eek:

Please read the Forum Rules & Guidelines, edit your post and add [code] tags

Next read the replies very carefully.

# 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

s/reply's/replies/