Is there any way to do a grep on a spool directory searching for an email address and then moving those file into another directory?
Craig. -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Cybertime Hostmaster Sent: Thursday, January 17, 2002 3:58 PM To: [EMAIL PROTECTED] Subject: [IMGate] Re: Log files? Her is the way I do it in FreeBSD: grep "serachterm" /var/log/maillog zgrep "searchterm" /var/log/maillog.#.gz (where # is the days ago you want to search.) zgrep is just a shorthand method of searching inside compressed files. The is a flag for grep that also does this, but I just use zgrep and am happy. So lets say I have [EMAIL PROTECTED] not getting mail. Not much to go on. It is better if I knew the sender. So I search for just hostmaster. grep "hostmaster" /var/log/maillog If this gives me too much, pipe the results to less. grep "hostmaster" /var/log/maillog | less Look for errors. See nothing today? Go to yesterday. zgrep "hostmaster" /var/log/maillog.1.gz | less In both there examples the problem is too much information. There is a solution that may help narrow things down before you use such a wide search. zgrep "hostmaster" /var/log/maillog.1.gz | grep "reject" zgrep "hostmaster" /var/log/maillog.1.gz | grep "reject" | less In both of these examples, I pipe from one instance of grep to a second. This lets me do an AND search. The second is then piped to less, which may or may not be needed. If I wanted an OR search it is a bit easier. Lets say I have two companies that are not able to send users information. Call them Acme.com and XYZ.net. For a simple OR search that would look for both of these in one shot, I do this: grep "Acme.com\|XYZ.net" /var/log/maillog and again, I can do these: grep "Acme.com\|XYZ.net" /var/log/maillog | less grep "Acme.com\|XYZ.net" /var/log/maillog | grep "reject" zgrep "Acme.com\|XYZ.net" /var/log/maillog.5.gz | grep "reject" | less Now, one last tip, redirect. If you are an old dos program user and batch programmer, you know what a redirect and pipe are. But just in case, redirect is how you can output to a file. zgrep "hostmaster" /var/log/maillog.1.gz > filename That will make a file called "filename" with the results of my zgrep. zgrep "hostmaster" /var/log/maillog.2.gz >> filename That will APPEND to a file called "filename" the results of my search. grep "hostmaster" /var/log/maillog | grep "reject" > temp.txt zgrep "hostmaster" /var/log/maillog.1.gz | grep "reject" >> temp.txt zgrep "hostmaster" /var/log/maillog.2.gz | grep "reject" >> temp.txt zgrep "hostmaster" /var/log/maillog.3.gz | grep "reject" >> temp.txt zgrep "hostmaster" /var/log/maillog.4.gz | grep "reject" >> temp.txt This will make a file named "temp.txt," put the rejects for hostmaster from today, and the previous 4 days into it. There are other ways to go through multiple files, but this is reasonably easy with the up-arrow repeat in FreeBSD. And that is the end of my maillog grepping 101. Hope it helps. ----- Original Message ----- From: "Jeffrey J. Young" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, January 17, 2002 11:09 AM Subject: [IMGate] Log files? > > DOH! I just sent this with the wrong subject... The joys of just hitting > Reply... > > Guys, > Dumb question from IMGate neophyte... One of my users is complaining > that they are not receiving mail. I know the account name but don't know > where to look to find out why... Log file? This domain is setup the same > as all the other domains we host, but it's just one guy having probs. > Imail is setup the same on all domains and local delivery between > different domains works fine. Just when it has to go through postfix.... > > > Thanks... > > Jeffrey J. Young > Developer/Lead Support > . . . . . . . . . . . . http://humankindsystems.com > . . . . . . . . . . . . w e c o d e. w e c a r e. > > > > >
