Skip to content

Instantly share code, notes, and snippets.

@kshimo69
Created March 3, 2012 14:33
Show Gist options
  • Save kshimo69/1966455 to your computer and use it in GitHub Desktop.
Save kshimo69/1966455 to your computer and use it in GitHub Desktop.
syslogの出力をsyslogdのrestart毎にファイル分割する ref: http://qiita.com/items/2979
FILE="tmp"; for i in messages.4 messages.3 messages.2 messages.1 messages; do while read LINE; do if echo $LINE|grep -q restart; then FILE="`echo $LINE|awk '{ print $1$2$3 }'`.log"; fi; echo $LINE >> $FILE; done < $i; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment