![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| 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 |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
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 |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
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
|
||||
| Google The UNIX and Linux Forums |