1 #! /usr/local/bin/python
3 # Replace \r by \n -- useful after transferring files from the Mac...
5 # Usage: crlf.py file ...
14 print 'usage:', sys
.argv
[0], 'file ...'
18 data
= open(file, 'r').read()
19 lines
= string
.splitfields(data
, '\r')
20 newdata
= string
.joinfields(lines
, '\n')
23 os
.rename(file, file + '~')
24 open(file, 'w').write(newdata
)