Perl script to scan through files | Unix Linux Forums | Shell Programming and Scripting

  Go Back    

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

Perl script to scan through files

Shell Programming and Scripting

Closed Thread    
Thread Tools Search this Thread Display Modes
Old 03-05-2008
gholdbhurg gholdbhurg is offline
Registered User
Join Date: Oct 2007
Last Activity: 25 February 2009, 12:17 PM EST
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
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
Sponsored Links
Old 03-05-2008
Smiling Dragon's Avatar
Smiling Dragon Smiling Dragon is offline Forum Advisor  
Disorganised User
Join Date: Nov 2007
Last Activity: 2 February 2015, 2:55 PM EST
Location: New Zealand
Posts: 1,048
Thanks: 21
Thanked 26 Times in 25 Posts

while read line
  if [ "`echo $line | cut -c 10-13`" = "ABCD" -a `echo $line | cut -c 620-640` -lt `echo $line | cut -c 560-580` ]
    echo $line >> /tmp/$$.txt
if [ -r /tmp/$$.txt ]
  /your/favourite/email/program < /tmp/$$.txt
  rm /tmp/$$.txt

Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Scan two files and print values missing shaliniyadav Shell Programming and Scripting 6 06-30-2010 09:37 AM
A script to scan a directory for XML files, apacheuk Shell Programming and Scripting 3 12-18-2009 06:50 AM
Script to Scan proclog files deeprajn95 Shell Programming and Scripting 3 05-12-2008 07:25 AM
Scan Multiple Dir/Files tonyd UNIX for Dummies Questions & Answers 7 03-30-2008 04:52 AM
Perl script to scan back lines gholdbhurg Shell Programming and Scripting 3 03-18-2008 01:33 PM

All times are GMT -4. The time now is 03:15 PM.