Unix/Linux Go Back    

Shell Programming and Scripting BSD, Linux, and UNIX shell scripting — Post awk, bash, csh, ksh, perl, php, python, sed, sh, shell scripts, and other shell scripting languages questions here.

Perl script to scan through files

Shell Programming and Scripting

Thread Tools Search this Thread Display Modes
Old Unix and Linux 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 Linux
Sponsored Links
Old Unix and Linux 03-05-2008
Smiling Dragon's Unix or Linux Image
Smiling Dragon Smiling Dragon is offline Forum Advisor  
Disorganised User
Join Date: Nov 2007
Last Activity: 27 July 2017, 4:23 PM EDT
Location: New Zealand
Posts: 1,060
Thanks: 25
Thanked 29 Times in 28 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 you@wher.you.are < /tmp/$$.txt
  rm /tmp/$$.txt

Sponsored Links

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux 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 08:37 AM
A script to scan a directory for XML files, apacheuk Shell Programming and Scripting 3 12-18-2009 05:50 AM
Script to Scan proclog files deeprajn95 Shell Programming and Scripting 3 05-12-2008 06:25 AM
Scan Multiple Dir/Files tonyd UNIX for Dummies Questions & Answers 7 03-30-2008 03:52 AM
Perl script to scan back lines gholdbhurg Shell Programming and Scripting 3 03-18-2008 12:33 PM

All times are GMT -4. The time now is 12:11 AM.