V
V
Vit Vas2018-03-25 15:43:15
linux
Vit Vas, 2018-03-25 15:43:15

How to get multiline text using AWK?

I'm trying to get a part of a multiline text between delimiters (for example "ru") from a text like this:

Это выводить не нужно
ruЭто многострочный текст
который нужно вывести
на экранru
И это выводить не нужно

I execute the command I get the output
awk '/ru/,/ru/' proba002
ruЭто многострочный текст
на экранru

those. prints the first and last line, the middle is discarded. How to get all text?
PS. Along the way, it would not hurt to get rid of the separators themselves as a result, but that is not so critical ...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vit Vas, 2018-03-25
@GorodokVVV

Everything turned out to be easier than I thought: PS. The delimiters were removed with sed:
awk '/^ru/,/ru$/' proba002 | sed s/ru//g

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question