bash script for listing all users with emails greater than 100mb
Hi,
Help me with a bash script to get a list of all users on a server with more than 100MB of mail. (Mail is kept in /home/username/Mail/ for each user.) I've never written a script before. Thanks, |
find /home -name Mail -a -size +100M |awk -F/ '{print $3}'
The above used the find command. It searches under /home for any file with the name "Mail" that is 100 MB or greater in size. This is then piped into the awk command. The options there set the field delimiter to "/" (intead of white space) then prints the 3rd field which would be the user's home directory which typically is the same as the user's login ID. type "man find" for more detail on find command. type "man awk" for more detail on awk command. |
You'll want to bookmark & read these:
http://rute.2038bug.com/index.html.gz http://tldp.org/LDP/Bash-Beginners-G...tml/index.html Possibly these as well http://www.tldp.org/LDP/abs/html/ http://www.grymoire.com/Unix/ (specifically awk & sed) |
Thank you very much jlightner.
And thanks to chrism01 too. |
All times are GMT -5. The time now is 09:15 PM. |