File: qgrep.py

package info (click to toggle)
python-subprocess32 3.2.7-2~bpo8%2B1
  • links: PTS, VCS
  • area: main
  • in suites: jessie-backports
  • size: 324 kB
  • sloc: python: 2,951; ansic: 792; makefile: 6
file content (10 lines) | stat: -rw-r--r-- 253 bytes parent folder | download | duplicates (20)
1
2
3
4
5
6
7
8
9
10
"""When called with a single argument, simulated fgrep with a single
argument and no options."""

import sys

if __name__ == "__main__":
    pattern = sys.argv[1]
    for line in sys.stdin:
        if pattern in line:
            sys.stdout.write(line)