efirvida
efirvida

Reputation: 4855

remove specific set of lines with bash script

Hi I came from a lot of threads to acomplish this task but neither works for me. I have a large amount of files that looks likes this:

{

    ... 

    frontAndBack
    {
        type            empty;
        inGroups        1 ( empty );
        nFaces          2428620;
        startFace       2264091;
    }

    frontAndBack
    {
        type            empty;
    }

}

and I want to remove the lines that contains this part:

    frontAndBack
    {
        type            empty;
    }

i try this:

sed -zi.bak 's/"    frontAndBack\n    {\n        type            empty;\n    }"//g' boundary

but didn't work. any help with this?

Upvotes: 0

Views: 39

Answers (1)

William Pursell
William Pursell

Reputation: 212248

Multi-line matching in sed is ... painful. But perl is great at this sort of thing:

perl -0777 -p -e 's/\s*frontAndBack\s*{\s*type\s*empty;\s*}//g' input-path 

Upvotes: 1

Related Questions