Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- # easy 'dos2unix' script
- # todo:
- # - make sure all arguments are files
- # - use temporary files
- import sys
- from shutil import move
- for file in sys.argv[1:]:
- newfile = file + ".new"
- nf = open(newfile, 'w')
- for line in open(file):
- nl = line.rstrip() + '\n'
- nf.write(nl)
- # move .new file onto original
- move(newfile, file)
Add Comment
Please, Sign In to add comment