grep self ignore
This commit is contained in:
@@ -2,5 +2,11 @@
|
|||||||
|
|
||||||
# How to strip leading "./" in "find"
|
# How to strip leading "./" in "find"
|
||||||
find -type f -printf '%P\n'
|
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".
|
||||||
Reference in New Issue
Block a user