N
N
Nikit_adw2018-07-04 08:04:37
linux
Nikit_adw, 2018-07-04 08:04:37

How to organize grep correctly?

The bottom line: you need to sort the document three times for three different results, and then compare these results with each other in order to deduce the discrepancy.
It is desirable to raise all this in the form of a bash script.
What is the best way to organize this? So far, only using the tee command comes to mind, saving the output with it in 3 different documents (or in one?) And comparing the lines in it somehow. I would be grateful for any hints.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
V
Victor Taran, 2018-07-04
@shambler81

cat 111.txt | grep 1 | grep 2 | grep 3
And even better show what is and what needs to be done

S
Saboteur, 2018-07-04
@saboteur_kiev

That's right - it's more clear to ask a question.
For example, give an example of input data and an example of the desired result.
I don't really understand what you want to do, but tee allows you to output the same output to multiple files, rather than different results for comparison.

S
Shirshov Alexander, 2018-07-04
@Keanor

string comparison can somehow be done through the diff utility

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question