<br><br><div class="gmail_quote">On Wed, Apr 8, 2009 at 2:05 PM, Tim Schofield <span dir="ltr"><<a href="mailto:tim@scoffer.net">tim@scoffer.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div></div><div class="h5">On Tue, 2009-04-07 at 11:11 +0100, william pink wrote:<br>
> Hi,<br>
><br>
> I have the rather horrible task of splitting up lots (40Gb's worth) of<br>
> Apache log files by date, the last time I did this I found the line<br>
> number I then tailed the file and outputted it into a new file which<br>
> was a long arduous task. I imagine this can be done in a few minutes<br>
> with some Regex/Sed/AwkBash trickery but I wouldn't know where to<br>
> start can anyone give me any pointers to get started?<br>
><br>
> Thanks,<br>
> Will<br>
<br>
</div></div>Hi<br>
<br>
time for i in {jan,feb,mar,apr,may,jun,jul,aug,sep,oct,nov,dec} ; do<br>
zcat access.*.gz | grep -i $i\/2008 | sort -k 4.9b,4.12bn -k 4.5b,4.7bM<br>
-k 4.2b,4.3bn -k 4.14b,4.15bn -k 4.17b,4.18bn -k 4.20b,4.21bn  ><br>
${i}_split.txt; done<br>
<br>
This bash oneliner works for me please note the hardcoded 2008 in the<br>
grep statement. It also splits the data by month and produces a bunch of<br>
files based on  month_split.txt. Also note the zcat statement this has<br>
to produce a concat of your input files.  Not sure if this will be able<br>
to handle 40 gigs worth of data though<br>
<font color="#888888"><br>
Tim<br>
</font><div><div></div><div class="h5"><br>
--<br>
Gllug mailing list  -  <a href="mailto:Gllug@gllug.org.uk">Gllug@gllug.org.uk</a><br>
<a href="http://lists.gllug.org.uk/mailman/listinfo/gllug" target="_blank">http://lists.gllug.org.uk/mailman/listinfo/gllug</a><br>
</div></div></blockquote></div><br><br>Hi,<br><br>Thanks but I decided to go through them manually with<br><br>grep -G "01\/Mar" access.log* >> access_march.log<br><br>I tried to adjust and use Tethys script but was only getting output files with no content and just got far to frustrated trying to get it to work.<br>
<br>I am now the proud owner of classic shell scripting now so Tet can sleep easier at night knowing I won't be posting anymore questions to the list regarding shell scripting. <br><br>Regards,<br>Will<br>