[CentOS] how to separate individual logs?

Raj kumar raj.k95 at gmail.com
Mon Nov 29 12:06:30 UTC 2010


Please unsubscribe the side on my email

-----Original Message-----
From: centos-bounces at centos.org [mailto:centos-bounces at centos.org] On Behalf
Of John Doe
Sent: 29 November 2010 16:50
To: CentOS mailing list
Subject: Re: [CentOS] how to separate individual logs?

From: hadi motamedi <motamedi24 at gmail.com>

> I have captured a file  in my centos showing logs captured from  many
> modules concurrently. Please find attached a sample of the file.  As
> you see, there are logs from individual modules that have been
> captured  concurrently. For example, there are logs from
> IPTR,SNMP,HLR,TCAP,XAPP,and  SCCP modules but they are coming
> concurrently.Each log has the header name of  its accompanied module in
> the beginning. I need to have the log of each  modules separately. Can
> you please show me the power of centos on how to  separate individual
> module's logs from the whole?

Here is "The Power of CentOS"!!!  (in approximately 3 minutes...)

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

JD

PS: I wonder if I am doing your school homework...


      
_______________________________________________
CentOS mailing list
CentOS at centos.org
http://lists.centos.org/mailman/listinfo/centos




More information about the CentOS mailing list