Brief and effective memory:
#!/usr/bin/env python # file: grep.py import re, sys map(sys.stdout.write,(l for l in sys.stdin if re.search(sys.argv[1],l)))
This works like egrep (without too much error handling), for example:
cat input-file | grep.py "RE"
And here is one line:
cat input-file | python -c "import re,sys;map(sys.stdout.write,(l for l in sys.stdin if re.search(sys.argv[1],l)))" "RE"
Giancarlo Sportelli Aug 07 '14 at 11:46 a.m. 2014-08-07 11:46
source share