Advertisement
Guest User

Untitled

a guest
May 22nd, 2015
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # encoding: utf-8
  3. #
  4. # Copyright (c) 2010 Doug Hellmann. All rights reserved.
  5. #
  6. """Simplistic grep implementation
  7. """
  8. #end_pymotw_header
  9.  
  10. import fileinput
  11. import sys
  12.  
  13. from_base = sys.argv[1]
  14. to_base = sys.argv[2]
  15. files = sys.argv[3:]
  16.  
  17. for line in fileinput.input(files, inplace=True):
  18. line = line.rstrip().replace(from_base, to_base)
  19. print line
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement