The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to send a mail in unix--Please read the description electroon Shell Programming and Scripting 2 01-03-2008 02:40 AM
how other user cannot read my script? happyv Shell Programming and Scripting 19 10-02-2006 12:01 PM
How to mark ALL mail items as read? Krispy UNIX for Dummies Questions & Answers 3 07-17-2006 12:53 PM
Tell UW-Imap to read /var/mail/mailbox ?? d11wtq UNIX for Dummies Questions & Answers 2 07-13-2005 07:26 PM
I need a script that script extract info from mail meravd Shell Programming and Scripting 1 10-19-2004 12:15 PM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 10-03-2006
misenkiser misenkiser is offline
Registered User
  
 

Join Date: Sep 2006
Posts: 36
script to read from mail

Hi,

I have a requirement in which I have to read mail from a unix text file and scan records having
failed records (any number > 0)

Firstly it should compare the file creation_date with sysdate
if the dates match then
do the checking for failed records

sample file i/p

Staged 0 records from <file_name> (2 failed)
Staged 0 records from <file_name> (0 failed)
Staged 0 records from <file_name> (0 failed)

09/27 12:45:46 I 0 Error Transactions
09/27 12:45:46 I 0 Error Transactions
09/27 12:45:46 I 0 Error Transactions


code:

var1=`grep -w "0 failed" <file_name>
var2=`grep -w "0 Error" <file_name>
if [[ -n $var1 || -n $var2 ]]; then
..... do something .....
else
..... do something .....
fi;


Is there any way I can do in a single command using sed
including the file date comparison with sysdate ?
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 11:37 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0