How to search keyword in a file in Linux OS?
I am not in good in Linux os, but I have keen interest about Linux, I want to search some keywords in a file that I need for my project.
Any one can help me out please?
I am not in good in Linux os, but I have keen interest about Linux, I want to search some keywords in a file that I need for my project.
Any one can help me out please?
Hi Winchel,
There are very nice tools to perform your job that you desired in Red Hat Linux System.
Grep is a command for you:
Prints lines of files where a pattern is matched
-v do not contain the pattern
-n lines with line number
-c a count of lines with matching pattern
-l name of file
-I a case insensitive search
Please try with this that you can find your answer…
# grep jhon /etc/passwd
# ps -ax | grep “init” <file name >
# grep -A -B “fish” <file name >
# grep -c “fish” <file name>
# grep -n “fish” <filename>
# grep “t[aeiou]sh” <file name>
Britnu Salu