You are not logged in. Log in now?
Show a Story
Filtering KVirc Logs With vim
In our series of highly specialized tasks nobody is likely to ever do, we present a way to quickly remove KVirc markup from IRC logs.
KVirc annotates lines in two ways:
- A number at the beginning of a line, indicating the type of the message,
- Annotations to mark e.g. user names and links.
Filtering the type number is trivial, but removing the annotation markers requires a bit of regex-fu. I chose to do it in vim, simply because it gave me visual feedback, and because I had it open anyway. The resulting command was:
- %s/^M\![a-z]\+^M\(.\{-}\)^M/\1/g
where ^M is a literal 0x0d character, input by ^v^m. The one not really intuitive part in that is the \{-} which is a non-greedy zero-or-more match, which would be expressed as *? in most other regular expression dialects.
By Shadowdancer, 2009-03-27, 10:12;
permalink;
Last updated at 2009-03-27, 10:16 by Shadowdancer