Featured
shell bash
Split Logs
Posted by Jean-Michel Frouin on .Pour scinder en fichier d'un million de lignes, les fichiers *.log.gz
Exemple d'utilisation : ./split_logs.sh monlog.log.gz
#!/bin/bash FILENAME=$1 FILENAME_GUNZIPPED=${1:0:${#1}-3} SPLIT_PREFIX=${1:0:${#1}-7} echo gunzip $FILENAME gunzip $FILENAME echo split -l 1000000 $FILENAME_GUNZIPPED $SPLIT_PREFIX split -l 1000000 $FILENAME_GUNZIPPED $SPLIT_PREFIX echo gzip $SPLIT_PREFIX[a-c]* gzip $SPLIT_PREFIX[a-c]* echo rm $FILENAME_GUNZIPPED rm $FILENAME_GUNZIPPED