grep self ignore

This commit is contained in:
daryl
2023-03-07 15:00:21 +10:30
parent 4bf2e28323
commit 4b279310c6

View File

@@ -2,5 +2,11 @@
# How to strip leading "./" in "find"
find -type f -printf '%P\n'
# From find manual: %P File's name with the name of the command line argument under which it was found removed.
# From find manual: %P File's name with the name of the command line argument under which it was found removed.
# Get a grep command to not find itself
<command> | grep '[p]attern'
# will find instances of 'pattern' in the output of <command> but not the grep command itself.
# Ref: https://stackoverflow.com/questions/20528894/how-does-ps-aux-grep-pattern-exclude-grep-itself
# The pattern "[p]attern" will not match the literal string "[p]attern". Instead it will match strings
# with exactly one char from the 1-character class "[p]", followed by "attern".