I am trying to split my IRSSI logs into weekly and monthly .log files. My log format looks like this:
--- Day changed Fri Mar 04 2016
00:11 <Jack> Test
--- Day changed Sat Mar 05 2016
00:11 <Jack> Test
--- Day changed Sun Mar 06 2016
15:20 <Jack> Test
The script I have been playing with that I am stuck on to split the logs looks like this:
grep -m 1 -n --regexp="^--- Day changed `date --date="$2" +"%a %b %d %Y"`$" $1 | cut -d ":" -f 1 | xargs -I '{}' tail --lines=+{} $1
$1 = The location of the .log file to split. $2 = A date string, I use "1 day ago" as an example.
When I run this script it will create my #chael-weekly.log file but it is empty, it isn't splitting the x number of days I tell it to.
All help appreciated, thanks!
- - , .
برچسب:
نویسنده: استخدام کار