Skip to content

Delete text between blank lines #1

Closed
@flywire

Description

@flywire

sed can easily delete text between blank lines but gnused treats blank lines differently.

An example would be worthwhile. Two come to mind, replacing three blank lines with a single blank line and deleting a line and the following blank line (paragraph) if it contains a search string. Non-gnused:

sed 's/\n.*kill.*\n\n/\n/g' sample_text

sample_text

This is a
sample text

    kill = whatever

demonstration.

output

This is a
sample text

demonstration.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions