This repository has been archived on 2021-08-17. You can view files and clone it, but cannot push or open issues or pull requests.
unix/mygrep
2018-10-06 17:23:33 +02:00
..
Makefile Initial commit 2018-10-03 18:46:59 +02:00
mygrep.c Add argument handling and a README for mygrep 2018-10-06 17:23:33 +02:00
mygrep.h Add argument handling and a README for mygrep 2018-10-06 17:23:33 +02:00
README.md Add argument handling and a README for mygrep 2018-10-06 17:23:33 +02:00

mygrep

A reduced variation of the Unix-command grep. It reads in several files and prints all lines containing a keyword.

SYNOPSIS mygrep [-i] [-o outfile] keyword [file...]

The program mygrep reads files line by line and for each line checks whether it contains the search term keyword. The line is printed if it contains the keyword, otherwise it is not printed. The program accepts lines of any length.

If one or multiple input files are specified (given as positional arguments after keyword), then mygrep reads each of them in the order they are given. If no input file is specified, the program reads from stdin.

If the option -o is given, the output is written to the specified file (outfile). Otherwise, the output is written to stdout.

If the option -i is given, the program does not differentiate between lower and upper case letters, i.e. the search for the keyword in a line is case insensitive.

Note: The description is from the task I got from TU.