Row to column converter using Awk or grep?

Hello,

Can someone please help me on this.:confused:
I have a file which has more than 1 million lines (XML file).

What I need is:

Search for "abcd" in the input file > output the result into a output.txt (colloum1)

Search for "efghi" in the input file > output the result in to a output.txt (coluun2)

Search for "zzzz" in the input file > output the result in to a output.txt (coluun3)

Thanks in advance

by the way there is
N input files but there should be only
1 output file

What defines a "column". Is the output to be in XML as well? Anyway, see "info paste" (since the man page might be a bit deficient). Essentially:

grep abcd file1 >output1.txt
grep efghi file1 >output2.txt
grep zzzz file1 >output3.txt
paste output[123].txt >output.txt
rm output[123].txt

Can you grep on each of the three inputs to temp files, called temp1 temp2 temp3
And then use the paste command to put them into columns

paste temp1 temp2 temp3 >finalfile