File: pyindex2upper.py

package info (click to toggle)
serpento 0.3.6
  • links: PTS
  • area: main
  • in suites: woody
  • size: 292 kB
  • ctags: 381
  • sloc: python: 1,644; ansic: 666; perl: 157; sh: 116; makefile: 72
file content (17 lines) | stat: -rwxr-xr-x 417 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/python
# read stdin (as pyindex file) and transform entries into UPPERCASE
# typical usage:
# konwert UTF8-ascii <file.index | pyindex2upper.py | sort > ascii-file.index

import sys
import string
from utils import TAB

while 1:
    l = sys.stdin.readline()
    if not l:
        break
    entry, rest = string.split(l, TAB, 1)
    entry = string.upper(entry)
    l = entry+TAB+rest
    sys.stdout.write(l)