In Linux, How do I display lines that contain a string in a text file, such as:
search "my string" file_name
How do I make the search case sensitive/insensitive?
And how do I also display the line numbers?
Regards
linuxsearchstrings
In Linux, How do I display lines that contain a string in a text file, such as:
search "my string" file_name
How do I make the search case sensitive/insensitive?
And how do I also display the line numbers?
Regards
Best Answer
well
will do for your particular query. GREP is by default case sensitive in nature and to make it case insensitive you can add -i option to it. The
-n
option displays the line numbers. For other myriad options, I recommendfor more interesting pattern matching capability of GREP.