Как настроить SSL для Apache2 на OpenSuSE 13.1

perl -00 -n -e 'print if (m/blue/i && m/green/i && m/yellow/i)' filename

Здесь используется режим чтения абзаца perl ( -00 ) для печати только абзацев, содержащих все три слова (с совпадениями без учета регистра).

«абзац» - это одна или несколько строк текста, отделенных от других абзацев как минимум одной пустой строкой.

например. Я сохранил текст вашего вопроса в файл и запустил на нем этот perl однострочник. Вывод:

i am trying to use grep to search a large text file, and return the
paragraph containing a few key words. I also want to return the
surrounding lines in the result. So, for example I have the following
words I am going to search for: blue, green, yellow. If I wanted to find
the paragraph containing all 3 words, in the file called 'colors.txt', I
tried the following code:

grep blue colors.txt | grep green | grep yellow

This only gave me the listings for yellow though, and not the ones that
had yellow, green and blue, in the paragraph.

т.е. всего 3 абзаца вывода, тогда как в вашем вопросе было 7 абзацев.

3
10.07.2016, 04:36
0 ответов

Теги

Похожие вопросы