S
S
Sergey2015-10-13 15:52:43
linux
Sergey, 2015-10-13 15:52:43

What is the equivalent of grep for only groups of lines?

GREP uses the \n character as line separators, but is there a utility that would work like grep, only for sets of lines?
Let's say there is a group of strings (bytes) that starts/ends with some character (string). Each new group of bytes starts with this character (string), or REGEX. You need to filter the content and show those groups of rows that have some content. Those. display not one line with content, but immediately a group of lines in which this content is.
Parameters A and B are not offered. I want a standard solution, but does it even exist?
Thank you.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Ruslan Fedoseev, 2015-10-13
@martin74ua

Formulate the task preferably with an example, or more clearly.
textutils are big, and then there's awk, sed, perl....

V
Victor Taran, 2015-10-30
@shambler81

1. grep can't.
2. Sed can, but you need to look at what exactly it does not always work well.
3. maybe patch is enough
for you

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question