Friday, February 27, 2009
Suppose in your sample file the word 'bash' is present in different cases (some are BASH,some bash, some Bash etc etc)
Now if you want to see all the occurrences of the string bash, you might not be interested to see the lines containing the different format of the word 'bash'.
So you can use -o option along with -i option with GNU grep
From GREP(1) man pages
Show only the part of a matching line that matches PATTERN.
Ignore case distinctions in both the PATTERN and the input files.
$ cat new.txt
help with bash
Index and match
$ grep -oi "bash" new.txt
© Jadu Saikia www.UNIXCL.com