Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 50599
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T16:37:07+00:00 2026-05-10T16:37:07+00:00

Here at work, we are working on a newsletter system that our clients can

  • 0

Here at work, we are working on a newsletter system that our clients can use. As an intern one of my jobs is to help with the smaller pieces of the puzzle. In this case what I need to do is scan the logs of the email server for bounced messages and add the emails and the reason the email bounced to a ‘bad email database’.

The bad emails table has two columns: ’email’ and ‘reason’ I use the following statement to get the information from the logs and send it to the Perl script

grep ' 550 ' /var/log/exim/main.log | awk '{print $5 '|' $23 ' ' $24 ' ' $25 ' ' $26 ' ' $27 ' ' $28 ' ' $29 ' ' $30 ' ' $31 ' ' $32 ' ' $33}' | perl /devl/bademails/getbademails.pl 

If you have sugestions on a more efficient awk script, then I would be glad to hear those too but my main focus is the Perl script. The awk pipes ‘foo@bar.com|reason for bounce’ to the Perl script. I want to take in these strings, split them at the | and put the two different parts into their respective columns in the database. Here’s what I have:

#!usr/bin/perl                                                                                                                                                                                 use strict; use warnings; use DBI;  my $dbpath = 'dbi:mysql:database=system;host=localhost:3306'; my $dbh = DBI->connect($dbpath, 'root', '******')     or die 'Can't open database: $DBI::errstr';  while(<STDIN>) {     my $line = $_;                                         my @list = # ?  this is where i am confused     for (my($i) = 0; $i < 1; $i++)     {         if (defined($list[$i]))         {             my @val = split('|', $list[$i]);             print 'Email: $val[0]\n';             print 'Reason: $val[1]';             my $sth = $dbh->prepare(qq{INSERT INTO bademails VALUES('$val[0]', '$val[1]')});             $sth->execute();                                                                                                               $sth->finish();                                                                                                                                                                                       }     } } exit 0; 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T16:37:07+00:00Added an answer on May 10, 2026 at 4:37 pm

    Something like this would work:

    while(<STDIN>) {   my $line = $_;   chomp($line);   my ($email,$reason) = split(/\|/, $line);   print 'Email: $email\n';   print 'Reason: $reason';   my $sth = $dbh->prepare(qq{INSERT INTO bademails VALUES(?, ?)});   $sth->execute($email, $reason);                                                                                                     $sth->finish();                                                                                                                                                                               } 

    You might find it easier to just do the whole thing in Perl. ‘next unless / 550 /’ could replace the grep and a regex could probably replace the awk.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 77k
  • Answers 77k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer Well I found the problem. I had two ISAPI Filters… May 11, 2026 at 3:28 pm
  • added an answer CREATE TYPE tp_concat AS (data TEXT[], delimiter TEXT); CREATE OR… May 11, 2026 at 3:28 pm
  • added an answer A rotation around an arbitrary point is usually a translation… May 11, 2026 at 3:28 pm

Related Questions

I'm currently working on cross-platform applications and was just curious as to how other
I'm working on writing a kernel, and I have a few friends working with
Where I'm at we have a software package running on a mainframe system. The
I'm working on a Rails web application, and it's currently being used by some

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.