krungkuene.org

back
to please me link this page
or look at my newest art stuff on my site --->
freedom fight for creativity
krung's knowledge pages

seite in deutsch

joins all log file to one big file

published:  2003-08-26
update: 2004-03-04

related pages: more shell scripts


this script decompress and joins all log file to one big file


EXAMPLE:

  you have the files:

  krungkuene.org-access.log
  krungkuene.org-access.log.1
  krungkuene.org-access.log.2.gz
  krungkuene.org-access.log.3.gz

  as name give:

  krungkuene.org-access.log

  as start number: 2

  as stop number: 3

  the result:

  krungkuene.org-access.log.join



download


logjoin.sh
logjoin.sh.gz


#!/bin/bash

# V 0.1.1 040304 logjoin.sh
# V 0.1.0 030826 logjoin.sh
#
# Licensed under GPL
#
#  ¢  ¢
#  ¢ ¢
#  ¢     ¢¢  ¢  ¢  ¢¢   ¢¢     ¢¢   ¢¢   ¢¢
#  ¢ ¢  ¢  ¢ ¢  ¢ ¢  ¢ ¢  ¢   ¢  ¢ ¢  ¢ ¢  ¢
#  ¢  ¢ ¢     ¢¢  ¢  ¢  ¢¢¢ ¢  ¢¢  ¢     ¢¢¢
#                         ¢                ¢
#        martin         ¢¢     krung     ¢¢
#
# ++++++++++++++++++++++++++++++++++++++++++++++++
#

#  DESCRIPTION
#
#  decompress and joins all log file to one big file
#

#  EXAMPLE
#
#  you have the files:
#
#  krungkuene.org-access.log
#  krungkuene.org-access.log.1
#  krungkuene.org-access.log.2.gz
#  krungkuene.org-access.log.3.gz
#
#  as name give:
#
#  krungkuene.org-access.log
#
#  as start number: 2
#
#  as stop number: 3
#
#  the result:
#
#  krungkuene.org-access.log.join

#
#  REQUIRE
#
#  cat, gunzip
#

#
#  WARNING
#
#  cannot damage anything
#
#  still use it on your own risk


# reads STDIN
echo "name of logfile?"
read NAME

echo "start number?"
read LOW

echo "stop number?"
read HEIGHT


rm -rv $NAME.join

for i in `seq  $HEIGHT -1 $LOW `; do

FILE=$NAME.$i.gz
echo  $FILE gunzip to $NAME.join
gunzip -vc $FILE >> $NAME.join

done


echo $NAME.1 join to $NAME.join
cat $NAME.1 >> $NAME.join


echo $NAME copy to $NAME.join
cat $NAME >> $NAME.join


Valid HTML 4.01! nano text editor Creative Commons License