S
S
Sergey2017-11-29 18:27:34
linux
Sergey, 2017-11-29 18:27:34

How to crack at the same time on several conditions?

Here is the log file.
You need to grep it for several conditions.
Type there is line No. 1 or (line No. 2 and line No. 3).
In case when just line #1: grep #1
When #2 and #3: grep #2 | grep #
3 combine the results of these 2 expressions ?
Well, like this, to print less and without regular expressions.
this would be perfect: #1|(#2 & #3).
I gave this as an example, in fact the conditions will be quite nested.
Thank you.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Mikhail Osher, 2017-11-29
@miraage

Without regular expressions, it is impossible to merge. And in general, you have man grep.
Read it first, then ask questions.
cat access.log | grep -P 'foo|bar|baz'

V
Victor Taran, 2017-11-30
@shambler81

cat access.log | grep -P 'foo|bar' | grep -P baz
and what is the problem?
or or and
well, coupled with this| grep -v 'исключить'

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question