Need to extract daily files

Hi,
I want to print my log separately for each day it contains;
-1st solutions was:
grep "^\[" file1.log | awk '{print $1}' >> $1day.log
but I noticed that awk doesn't eat records that have more than 99 fields, so I get the error "... too many fields; Broken pipe. "
-2nd one:
grep "^\[
" file1.log | sed -n <pattern> >> day.log

problem: how to identify each day in sed separately ?

file1.log comes from IBM WebSphere and looks like:

[20/07/05 mm:dd hh:MM] ...

.. :cool: many thanks from Rome.

Carmen
Hi,
I want to print my log separately for each day it contains;
-1st solutions was:
grep "^\[" file1.log | awk '{print $1}' >> $1day.log
but I noticed that awk doesn't eat records that have more than 99 fields, so I get the error "... too many fields; Broken pipe. "
-2nd one:
grep "^\[
" file1.log | sed -n <pattern> >> day.log

problem: how to identify each day in sed separately ?

file1.log comes from IBM WebSphere and looks like:

[20/07/05 mm:dd hh:MM] ...

.. :cool: many thanks from Rome.

Carmen

Why do you want to use grep with sed ?

Just use a sed and print those lines which contain the regex.

DATE=20/07/05

sed -n -e "/[${DATE}.*/p" file1.log > ${DATE}.log

For the next date, DATE should be updated.

Vino

Vino,
response from SunOS 5.8 is

sed: command garbled: /[20/07....

Vino=Wine here.

Try this.

I escaped the [ and made sed look for a [ at the beginning of the string.

sed -n -e "/^\[${DATE}.*/p" file1.log > ${DATE}.log

Vino