how to check for error in a particular file
Hi I try
for i in 1 to 100 do #execute prog content=$(</tmp/htx.flpb_sqrt0) #output file after prog executed echo $content done Output file [default CON]: Successful Tests: 0 Numerical Errors: 0 I need to check if the numerical error is not 0 in the file. how to go abt using script and saving the output to a file? thanks |
Moin,
you can use sed to extract the interesting part of the file (I assume it has only this one line?): Code:
num_errors=$(sed -r 's/.*Numerical Errors: ([0-9]+).*/\1/' /tmp/htx.flpb_sqrt0) Code:
if test $num_errors -ne 0; then Code:
echo $num_error >output_file |
All times are GMT -5. The time now is 02:36 PM. |