From: hadi motamedi motamedi24@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...