import os, re, sys
import string
reg = re.compile(r'^([a-zA-Z0-9_]+)(.*)|(.*)$')

chars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_"

def remove_space(str):
	plop = ""
	for i in str:
		if i in chars:
			plop += i
	return plop

if __name__ == "__main__":
	fname = sys.argv[1]
	pname = fname[:fname.rfind('.txt')] + '.pds' # php definition sink
	fin = open(fname, 'r')
	fout = open(pname, 'w')
	for l in fin.readlines():
		if '*' in l:
			locStr = l[l.find('*')+1:]
			locStr = locStr[:locStr.find('|')]
			locStr = remove_space(locStr)
			if len(locStr) > 0:
				fout.write("%s\n" % locStr )
	fout.close()
	fin.close()






