Commits

Anonymous committed a0c7e6f

first commit

  • Participants

Comments (0)

Files changed (4)

+syntax:glob
+*~
+.*.swp
+import sys
+
+for filename in sys.argv[1:]:
+    print(open(filename).read())
+import sys
+import re
+import argparse
+
+parser = argparse.ArgumentParser()
+parser.add_argument('pattern')
+parser.add_argument('filename', nargs="+")
+
+args = parser.parse_args()
+
+pattern = args.pattern
+regex = re.compile(pattern)
+
+for filename in args.filename:
+    try:
+        f = open(filename)
+        for i, line in enumerate(f):
+            if regex.search(line):
+                print('%s:%d:' % (filename, i), line)
+    except IOError as e:
+        print(e)

File printargs.py

+import sys
+
+for a in sys.argv[1:]:
+    print(a)