Advertisement

01.11.2008 at 09:03PM PST, ID: 23077561
[x]
Attachment Details

txt processing, removing lines before and after match.

Asked by zgxwgrt in Perl Programming Language, Miscellaneous Programming, Shell Scripting

Tags: *nix or similar, shell, any, txt processing, nix, shell, perl, other

I've got a .txt file similar to the one below, except mine has thousands of blocks similar to the ones shown.

My goal is to find all of the 172.* entries that are NOT of a particular MAC type (say 00:0d:97:blah) and remove them.  Resulting in a new file containing all but those text blocks, block being defined by 'lease x.x.x.x through next '}'.  Please HELP me....

lease 10.0.0.50 {
  starts 1 2007/07/23 16:41:48;
  ends 1 2007/07/23 17:26:43;
  tstp 1 2007/07/23 17:26:43;
  binding state free;
  hardware ethernet 00:11:6e:8d:2f:84;
  uid "\001\000\021n\215/\204";
}
lease 172.17.65.5 {
  starts 5 2007/08/03 17:02:30;
  ends 6 2007/08/04 17:02:30;
  tstp 6 2007/08/04 17:02:30;
  binding state free;
  hardware ethernet 00:0d:97:12:49:40;
}
lease 192.168.2.40 {
  starts 0 2007/08/05 12:04:20;
  ends 1 2007/08/06 12:04:20;
  tstp 1 2007/08/06 12:04:20;
  binding state free;
  hardware ethernet 00:11:6e:8b:01:c4;
  uid "\001\000\021n\213\001\304";
}

Start Free Trial
 
Loading Advertisement...
 
[+][-]01.11.2008 at 09:13PM PST, ID: 20642842

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.11.2008 at 09:19PM PST, ID: 20642858

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.11.2008 at 09:26PM PST, ID: 20642873

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.11.2008 at 09:29PM PST, ID: 20642877

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.11.2008 at 09:33PM PST, ID: 20642887

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.11.2008 at 09:40PM PST, ID: 20642898

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.11.2008 at 09:52PM PST, ID: 20642928

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Perl Programming Language, Miscellaneous Programming, Shell Scripting
Tags: *nix or similar, shell, any, txt processing, nix, shell, perl, other
Sign Up Now!
Solution Provided By: ozo
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628