|
Literature
Africa |
Command LineBeing able to use the command line well is a real bonus when using Linux. All of the commands below have a manual page where you can get more information. Type man command at the shell prompt. Commands
ExamplesExample 1
grep mailer=local /var/log/maillog | grep "Mar 14" | cut -d',' -f1 | cut -d'=' -f2 | cut -d'@' -f1 | sed -e's/<//' |
sort | uniq -i | sed -e's/$/@src.wits.ac.za/'
will extract from the file /var/log/maillog lines that look like
Mar 14 23:30:27 schonlan sendmail[27155]: k2ELUGfh027154: to=<user@schonlan.src.wits.ac.za>, delay=00:00:03,
xdelay=00:00:03, mailer=local, pri=40038, dsn=2.0.0, stat=Sent
Mar 14 13:59:54 schonlan sendmail[24546]: k2EBwsfh024545: to=anotheruser, delay=00:01:00, xdelay=00:00:03,
mailer=local, pri=816326, dsn=2.0.0, stat=Sent
and turn them into a unique set of email addresses like Example 2To recursively delete only specific files ...... first check for the files you want to delete: find /path_to_search -type f -name "*the_patern*" and then, delete :
find /path_to_search -type f -name "*the_patern*" -exec rm {} \;
NB: the '\' and the ';' are important |