No such thing as a small change | |
PerlMonks |
Success story: Converting logsby vrk (Chaplain) |
on Oct 13, 2007 at 20:31 UTC ( [id://644674]=perlmeditation: print w/replies, xml ) | Need Help?? |
My girlfriend is doing her PhD in sociology, and her research involves interviews with participants and groups online -- MSN, IRC, whatever technology happens to work. She naturally saves logs of these interviews for later analysis. Recently, I discovered that she was converting the log files to a more suitable format by hand. Since MSN Messenger, for instance, saves its logs in XML, I shuddered at the thought, and immediately offered my Perl skills. Indeed, I was reminded of this comic strip: Regular Expressions Ten minutes and fifteen lines of code later, using XML::Twig, I had a script that could extract the text data from the log files in a suitable format. One finishing touch was piping the output to fmt(1) to format the paragraphs containing the message strings so that they were properly indented; I indented the first line with a \t in the Perl script already. Five minutes later I had a five-line script for extracting in the same simple output format text data from irssi log files. Together, my fifteen minutes of effort saved her 12 hours of numb mouse usage and copy-pasting; a 48-fold difference in time spent. (Do you have similar experiences in saving time?) She also didn't let me leave the bed for a few hours afterwards. Which was nice.
--
Back to
Meditations
|
|