Вопрос

# spam.txt
src/blahblah/potato.py
src/migrations/helloworld.py
spam/blahblah/thing.py
src/thingy/other.cpp

I have this:

$ cat spam.txt | grep 'src.*\.py' | grep --invert-match '/migrations/'
src/blahblah/potato.py

How can I chain the exclude into the same pattern? i.e. how can I write the 'pattern???' below so that I get the same result?

$ grep 'pattern???' spam.txt
Это было полезно?

Решение

Better

awk '/src/ && /\.py/ && ! /migrations/' spam.txt

Example

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top