Hello !

I am a novice in shell scripting and I face a simple problem with 'grep' and the documentation doesn't help me

the text file I want to process looks like (every 3 lines are part of a 'block' e.g. lines 11 12 13 form what I call a block) :

line11 blabla1
line12 blabla2..
line13 blabla3..
line21 blabla1.. DesiredInfo
line22 blabla2..
line23 blabla3..
line31 blabla1.. DesiredInfo
line32 blabla2..
line33 blabla3..
etc.
the desired data is on each 2 first lines of some 'blocks'.. so I started by using the following so as to join the desired 2 lines in 1 (and skip the 3rd) in order to use it after with grep/sed :
Code:
#!/bin/bash
#script.sh
(while read line;
do
	read line2;
	read line3;
	echo $line $line2;
done;)
Now I want to select only the lines containing the "DesiredInfo", for that I thought simply of adding a pipe to grep after the preceding code:

Code:
 | grep DesiredInfo
but.. it doesn't work like that...(nothing happens) so I thought of putting directly in the shell prompt instead of the script:
bash script.sh < directory/file.txt | grep DesiredInfo
but then again, nothing happens...

thank you for your precious help !!

EDIT:
I found what the problem was...
actually that pipe worked but it takes so much time (50 sec. !!) to print the output that I thought there was a problem...

Thank you for taking the time to read it anyway !