Skip to content

Instantly share code, notes, and snippets.

@kiyoto
Created October 10, 2012 01:12
Show Gist options
  • Save kiyoto/3862549 to your computer and use it in GitHub Desktop.
Save kiyoto/3862549 to your computer and use it in GitHub Desktop.
anonymize/filter out timestamps from Adium chat logs
#!/usr/bin/env ruby
# to parse Adium conversation
regex = /^[\d:]+ [AP]M (?<name>[^:]+): (?<msg>.*)$/
for line in STDIN
m = regex.match(line)
next if not m
name = m['name']
msg = m['msg']
if not name or not msg
puts line
next
end
if name.downcase == 'kiyoto'
name = 'me '
else
name = 'amigo'
end
puts "#{name}: #{msg}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment