I have a lot of lines in my LIST file and want to list only lines whose name does not start by (or contains) "git".
So far I have :
cat LIST | grep ^[^g]
but I would like something like :
#not starting by "git"
cat LIST | grep ^[^(git)]
#not containing "git"
cat LIST | grep .*[^(git)].*
but it is not correct. What regex should I use ?
Best Answer
Using
grep
in this case with-P
option, which Interprets the PATTERN as a Perl regular expressionRegular expression explanation:
Using the
find
command