Printable Version of Topic

Click here to view this topic in its original format

Linuxhelp _ Technical Support _ Two question of the newbie

Posted by: ruvoodoo Jul 25 2011, 05:25 AM

Headache for a couple of days about this questions.
First: I have many many >> 1000 files like abc_de_XXXXXX, where XXXXXX random numbers. I need to calculate the number of this files, determine their total size, and delete them except the last 10.
My solution:
find -name 'abc_de*' | xargs ls -1S > /tmp/trash.txt - find them all and save list to the file.
wc -l /tmp/trash.txt - total number of this files.
Then, after some googling, i`ve find a way, how determine their total size:
find -name 'abc_de*' -exec stat -c%s {} \; | awk '{total += $1} END {print total}' - but this pretty hard for my sad.gif
And last task (delete them, except the last 10) - I don`t know how do this.

The second questions is: use only command ps, awk, gawk, grep to determine total amount of memory used by Oracle processes. Could your help me?

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)