[CentOS] how to separate individual logs?

Tue Nov 30 09:58:15 UTC 2010
John Doe <jdmls at yahoo.com>

From: hadi motamedi <motamedi24 at gmail.com>

> On 11/29/10, John Doe <jdmls at yahoo.com> wrote:
> >  cat edit.txt | while read LINE; do
> >   echo "$LINE" | grep -q  '>\.\.'
> >   if [ $? -eq 0 ]; then
> >      LOGFILE=`echo $LINE | cut -d' ' -f1`.log
> >   else
> >      echo "$LINE" >> $LOGFILE
> >   fi
> >  done
> Thank you very much for your help. I tried  for your code but I am
> receiving the following error:
> -bash:[1:command not  found
> -bash:$LOGFILE:ambiguous redirect
> Can you please correct  me?

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