Beruflich Dokumente
Kultur Dokumente
in UNIX
Anisha (31)
Jaee (32)
Amber (33)
Nihar (34)
Shanawaz (35)
Introduction
• Basically when we create a file in
UNIX or in any OS, we always need a
way to search whatever we want in
that file.
• In UNIX basically grep, fgrep, sed, sh
are different types of commands
which are used for searching a
pattern in an input file.
• Depending upon user needs this
command gives output/search result
from given file.
grep command
• Used for searching & printing the
specified pattern from input.
• It is the abbreviation for “Global
search for regular expression &
print”.
• Where “Global” means entire file or
standard input.
• “regular expression” means
metachar pattern.
• “print” means to print ‘em all .
• Syntax for grep: grep [options] pattern
file/s
• List of controls:
l -i : Ignore case distinctions in both the
PATTERN and the input files.
Input : $ grep –i 19 demo.txt
output : Anisha | 19 | F | 31
$ cat demo.txt
Anisha | 19 | F | 31
Jaee | 18 | F | 32
Amber | 18 | M | 33
Nihar | 18 | M | 34
Shanawaz | 18 | M | 35