To compare strings without case sensitivity, fold the values using tolower() or toupper() . Using tolower() or toupper() or the above in either order makes no difference when looking for equality, but can make an order difference.
the grep Case Insensitive With the -i Option The grep command's -i option can perform a case-insensitive search. For a case-insensitive search, the search pattern THANOS matches Thanos , ThaNos , or ThanoS . The ignore-case option is a more extended variant of the -i option.
Grep is case-sensitive by default hence it shows the perceptibility of both upper and lower cases in the file.
Case insensitive search : The -i option enables to search for a string case insensitively in the given file.
You can use the -i
flag which makes your pattern case insensitive:
grep -iF "success..." file1
Also, there is no need for cat
. grep
takes a file with the syntax grep <pattern> <file>
. I also used the -F
flag to search for a fixed string to avoid escaping the ellipsis.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With