I'm currently writing a simple .sh script to parse an Exim log file for strings matching " o' ". Currently, when viewing output.txt, all that is there is a 0 printed on every line(606 lines). I'm guessing my logic is wrong, as awk does not throw any errors.

Here is my code:

grep "o'" /var/log/exim/main.log |
        awk '{
                line = "> ";
                for(i = 20; i <= 33; i++)
                                line += " " + $i;
                print line;
        }' > output.txt

Any ideas? Alternatively, is there an easier way to display a line of strings with each input from grep? Before, I was just using a for loop with "print $i" as the executed statement each iteration. This put every string(from 20 to 33) on its own line, which is less than optimal and somewhat unreadable.

EDIT: Yes, I am running Red Hat. Only reason I post in this subforum.