Linux Shell Scripting Tutorial (LSST) v1.05r3 | ||
Chapter 5: Essential Utilities for Power User | ||
|
hello world!
cartoons are good
especially toon like tom (cat)
what
the number one song
12221
they love us
I too
After saving file, issue following command,
$ grep "too" demofile
cartoons are good
especially toon like tom (cat)
I too
grep will locate all lines for the "too" pattern and print all (matched) such line on-screen. grep prints too, as well as cartoons and toon; because grep treat "too" as expression. Expression by grep is read as the letter t followed by o and so on. So if this expression is found any where on line its printed. grep don't understand words.
Syntax:
grep "word-to-find" {file-name}
Removing duplicate lines from text database file using uniq utility | Learning expressions with ex |