Hi all, in a previous post I asked help for colorizing expanded tab. I wanted to list text files showing in colors LFs and the expanded tabs. I hoped to use only bash but, being impossible, I reverted to Python. I programmed a very short script . Here it is (... and I ask comments or critics):
# for Linux users # starting from a list of all the lines of a text files (lFileList) nNP=9 # n. of Not Printables characters for line in lFileList: nTab= line.count('\t') if nTab > 0: for i in range(nTab): nPosTab=line.find('\t') line=line.replace('\t',"\033[41m"+\ (8-(nPosTab-(nNP*i))%8)*' '+"\033[0m",1) print line.replace('\n',"\033[7m \033[0m\n"), print The Linux users can also use piping. For example: python lft.py lft.py|grep range correctly displays: for i in range(nTab): + the mark of the LF (a small white rectangle) Bye. -- http://mail.python.org/mailman/listinfo/python-list