Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2008
    Posts
    14

    * how to... get only emails from exim.log?

    Hello, I need to analize exim.log and I have to 'cut' ONLY emails, I`ve got for example

    2008-04-13 04:02:16 1JkpDm-0007aN-V6 == [email protected] R=lookuphost T=remote_smtp defer (-53): retry time not reached for any host

    I think I should use 'cut' command but I don`t really know how to use it, could somebody help me? I want add that it is exim.log with many lines, I want grep only emails. Thanks in advance!
    Last edited by papajo; 04-16-2008 at 05:32 PM.

  2. #2
    You could use this perl script. Just create the script chmod +x it and change the path referenced by $file to the path to your file. It will list emails 1 per line

    #!/usr/bin/perl

    $file="your path";
    @emails;
    open(MYF,"$file");
    while(<MYF>){
    $line=$_;
    chomp $line;
    if($line=~/(\w+\@\w+\.\w{2,4})\s+/){
    push(@emails,$1);
    }
    $line="";
    }
    foreach $item (@emails){
    print $item."\n";
    }
    A beginner's guide to choosing a web host
    Linux, Windows, Mac, Why can't we all just get along?

  3. #3
    Join Date
    Apr 2008
    Posts
    14
    Thanks I also used cut -d ' ' -f5 and it works also, thanks again!
    Hmm works different, I will analyze perl
    // edit
    yeah cut command also get error messages with grep @ works fine.
    Last edited by papajo; 04-16-2008 at 06:19 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •