Hello Experts,

I am new at this and need some help. I am looking for a delete command that allows me after I grep for the hostname to delete all the lines between two characters. for example I want to delete the first line all the way up to the } character

host test019 {
hardware ethernet F:F:F:F:F:F;
fixed-address secap1019;
group Servers;
}

Thanks in advance.

Hey There,

I'm assuming you meant the first line up to the { character (Let me know if I'm wrong). You could do this, keeping it simple:

grep test019|sed -n 's/.*\({\)/\1/p'

Of course this very simple, using static variables from your example.

Best wishes,

Mike

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.