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 here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Script to Scan proclog files deeprajn95 Shell Programming and Scripting 3 05-12-2008 03:25 AM
Scan Multiple Dir/Files tonyd UNIX for Dummies Questions & Answers 7 03-30-2008 12:52 AM
Perl script to scan back lines gholdbhurg Shell Programming and Scripting 3 03-18-2008 09:33 AM
port scan shell script nrbhole Shell Programming and Scripting 3 01-31-2008 08:28 AM
Perl Script - Sending files on a particular port rahulrathod Shell Programming and Scripting 1 12-01-2005 07:34 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 03-05-2008
Registered User
 

Join Date: Oct 2007
Posts: 25
Perl script to scan through files

Dear perl gurus,
I plan to create a script that will scan through a logfile line by line.
And if ever a certain line meets the below conditions, it will alert me via email.
-->
a) Position 10 to 13 = "ABCD"
b) And also if the amount specified in position 620-640 is less than the amount in position 560-580
Ex: Position620-640 = 00000002000000.000000
Position560-580 = 00000005000000.000000

Thanks in advance
Reply With Quote
Forum Sponsor
  #2  
Old 03-05-2008
Smiling Dragon's Avatar
Disorganised User
 
Join Date: Nov 2007
Location: New Zealand
Posts: 734
Post

Code:
#!/bin/sh
while read line
do
  if [ "`echo $line | cut -c 10-13`" = "ABCD" -a `echo $line | cut -c 620-640` -lt `echo $line | cut -c 560-580` ]
  then
    echo $line >> /tmp/$$.txt
  fi
done
if [ -r /tmp/$$.txt ]
then
  /your/favourite/email/program you@wher.you.are < /tmp/$$.txt
  rm /tmp/$$.txt
fi
Untested
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 01:44 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0