grep -i
-i will ignore case sensitive
grep -B5
for example we want to see 5 lines before the keyword of krb5asrep. The below command will help.
Say you want to find only email address from a bunch of files:
grep -r @gmail.com .
grep -r -E -o "\b[a-zA-Z0-9.-]+@[a-zA-Z0-9.-]+.[a-zA-Z0-9.-]+\b" .
-r: This option tells grep to search recursively in all files and subdirectories within the specified directory (in this case, the current directory denoted by .
-E: This option enables the use of extended regular expressions, which allows us to use more complex patterns for matching.
-o: This option instructs grep to only output the part of the line that matches the specified pattern. In this case, it will only display the email addresses that are found in the files.
-i: This option makes the search case-insensitive, meaning it will match both uppercase and lowercase letters for the email addresses.
\b: This is a word boundary anchor, which ensures that the email address is matched as a whole word and not just as part of a larger word.
Avi
Comments
Post a Comment