]> git.phdru.name Git - dotfiles.git/commitdiff
Remove bin/replace: Use `sed -i` instead
authorOleg Broytman <phd@phdru.name>
Tue, 6 Mar 2018 08:42:39 +0000 (11:42 +0300)
committerOleg Broytman <phd@phdru.name>
Tue, 6 Mar 2018 08:42:39 +0000 (11:42 +0300)
bin/replace [deleted file]

diff --git a/bin/replace b/bin/replace
deleted file mode 100755 (executable)
index 8ff7124..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-#! /usr/bin/env python
-
-import sys
-
-if len(sys.argv) < 4:
-   sys.stderr.write("Usage: %s [-i] from_re to_re file....\n" % sys.argv[0])
-   sys.exit(1)
-
-import re
-if sys.argv[1] == '-i':
-    search = re.compile(sys.argv[2], re.IGNORECASE)
-    replace = sys.argv[3]
-    start = 4
-else:
-    search = re.compile(sys.argv[1])
-    replace = sys.argv[2]
-    start = 3
-
-from fileinput import FileInput
-files = FileInput(sys.argv[start:], inplace=1)
-
-for line in files:
-   line = search.sub(replace, line)
-   sys.stdout.write(line)
-
-files.close()