On 11/30/10, John Doe <jdmls at yahoo.com> wrote: > The trick is that your original file has '\r' chars lurking around... > Forgot I did removed them manualy when I saw them... > > cat Edit3 | tr -d "\r" | while read LINE; do > > Instead of just copy/pasting, try to understand what it does. > Here is how it works: > - Read each line in the LINE variable. > - If the line contains the string '>..', it is a "section" line. > Set the log filename to the section title. > - If not, just write the line to the current log filename. > > JD Sorry. I didn't get the point clearly. What I need is to separate the log files from each of the modules. For example, I need all of the log files coming from XAPP module. In the main log, it can be distinguished by searching for the following line: XAPP >.. Then you see subsequent lines that are logs coming from this module. Then the logs from another module will come following the previous one. I think you code is not doing this . Can you please correct me on my understanding of your code body?