Nasser Heidari

2009-07-29

Sum using awk

Filed under: Linux — Nasser Heidari @ 10:28

Sum a column of file sizes output from an ls command using awk:

# ls -l *.iso | awk '{ SUM += $5} END { print SUM/1024/1024 }'

the below command will show you amount of memory used by apache :

# ps -ylC httpd --sort:rss | awk '{ SUM += $8 } END { print SUM/1024 }'

Advertisements

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: