i have a script that will read each line and then grep a particular pattern and do some_stuff. Below the script
while read j
do
q1=0
q1=`$j | grep 'INFO - LPBatch:' | wc -l`
if [ $q1 -eq 1 ]
then
$j | tr -s " " | cut -d " " -f8,42,43 >> nav1.txt
fi
q2=0
q2=`$j | grep 'INFO - Number of Intervals Not Inserted:' | wc -l`
if [ $q2 -eq 1 ]
then
$j | tr -s " " | cut -d " " -f6-13 >> nav1.txt
fi
done < nav11.txt
-----------------------------------------------------------------------
below some of the lines of the file nav11.txt
2008-10-14 05:47:05,551 [Thread-6] ERROR - CleanLPDataMessage: Missing Intervals: 1
2008-10-14 05:47:05,551 [Thread-6] INFO - LPBatch: [null, 1-GH32X, null, DC:Tue Oct 14 10:12:37 UTC 2008, null, null, Mon Oct 13 05:00:00 CDT 2008, Mon Oct 13 10:00:00 UTC 2008, Tue Oct 14 04:45:00 CDT 2008, Tue Oct 14 09:45:00 UTC 2008, CC, AMR, 94]
2008-10-14 05:47:05,575 [Thread-6] INFO - Number of Intervals Not Inserted: 1 / 95
2008-10-14 05:02:56,762 [Thread-6] ERROR - CleanLPDataMessage: Missing Intervals: 3
2008-10-14 05:02:56,763 [Thread-6] INFO - LPBatch: [null, 1-VIN74, null, DC:Tue Oct 14 09:29:49 UTC 2008, null, null, Mon Oct 13 04:00:00 CDT 2008, Mon Oct 13 09:00:00 UTC 2008, Tue Oct 14 04:00:00 CDT 2008, Tue Oct 14 09:00:00 UTC 2008, CC, AMR, 97]
2008-10-14 05:02:56,763 [Thread-7] INFO - Register Read: [1-X22K8, 0.0, Tue
------------------------------------------------------------------------
the while part is having some problem.can anyone help me in this?