Leaving for loop on condition

hi all,
i have a problem...no dream :slight_smile:
i want to scan a file i use the loop famous
while read line
do

do < myfile

but this scan must finish when find the another string .
How can i do it?
best regards for all.
Francesco

You did a typo error :

while read line 
do
 
done < myfile

you can then code whatever you want in the loop, if you want to go out of the loop, use the break command.

my problem is :
i have this report ....

Engine Busy Utilization CPU Busy I/O Busy Idle
------------------------ -------- -------- --------
Engine 0 0.0 % 0.0 % 100.0 %
Engine 1 0.0 % 0.0 % 100.0 %
Engine 2 0.2 % 0.0 % 99.8 %
Engine 3 0.0 % 0.0 % 100.0 %
Engine 4 0.0 % 0.0 % 100.0 %
Engine 5 0.0 % 0.0 % 100.0 %
Engine 6 0.0 % 0.0 % 100.0 %
Engine 7 0.0 % 0.0 % 100.0 %
Engine 8 0.0 % 0.0 % 100.0 %
Engine 9 0.0 % 0.0 % 100.0 %
Engine 10 0.0 % 0.0 % 100.0 %
Engine 11 0.0 % 0.0 % 100.0 %
Engine 12 0.0 % 0.0 % 100.0 %
Engine 13 0.0 % 0.0 % 100.0 %
Engine 14 0.0 % 0.0 % 100.0 %
------------------------ -------- -------- --------
Summary Total 0.2 % 0.0 % 1499.8 %
Average 0.0 % 0.0 % 100.0 %

must begin with "Engine 0" and must finish when match the string "Average"

We already replied to this in the thead you post about your 'grep problem'

sed '/Engine 0/,/Average/!d;/Average/q' pippo.out

the output don't give nobodoy results.

:frowning:

Then go back to your initial thread

and post an update about the problem you encountered.