下記の Python 版。
OpenLDAP 2.4: 格納したUTF-8データの読み出し
http://yasu-2.blogspot.jp/2009/10/openldap-24-utf-8.html
ruby が入れられない環境だったので、デフォルトで入っていることが多い Python で動くものを作りました。
30分くらいで Python 思い出しながら書いたので出来はお察しです。
書く時間よりも思い出す時間の方が長いという…
lsuf.py
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import sys, re
for line in sys.stdin:
if re.match(r'^\w+::\s', line):
label, b64item = line.split()
print label, b64item.decode('base64')
else:
sys.stdout.write(line)
(@shiracamus さんがシンプルにしてくれたので反映しました。ありがとうございます!)