Hello All,
I have log file the result from a multithreaded process. So when a process finishes it will write to this log file as 123 rows merged.
The issue is sometimes the processess finish at the same time or write to the file at the same time as
123 rows merged.145 rows merged.
At the end of the script we do a source count from table and target count from log file. As you can see the above line will fail grep as grep will identify the line and move on while awk will take the first parameter as 123 only.
I have used the following command to correct this
grep -i "^[0-9].* rows merged" ttt | sed 's/merged\./merged\
/g' | grep -i "^[0-9].* rows merged" | sed '/^$/'d | awk '{print $1}' | while read X
do
echo $X
Y=`expr $Y + $X`
done
echo $Y
TCOUNT=${Y}
but there was another instance when this script failed because the log file has something like
Commit complete.150 rows merged.Commit complete.
The above 150 rows that were merged didn't get counted. I would like to find [0-9].* rows merged anywhere on any line and separate this pattern into a new line
EG: the above Commit complete.150 rows merged.Commit complete.
should become
Commit complete.
150 rows merged.
Commit complete.
Any help will be greatly appreciated.
Thanks