B
Brian Andrus
Ok, no surprise, but I have having trouble figuring out regular
expressions.
I want to parse a data file in perl to find a mac address of a
particular IP.
The format of the data file is something like:
lease 192.168.1.199 {
starts 1 2003/8/11 00:00:67;
ends 1 2003/08/11 00:05:67;
hardware ethernet 00:c0:f7:43:c0:25;
client-hostname "brad";
}
So I only want to return the line hardware ethernet IF it is enclosed
within the lease 192.168.1.199 set. Also that set shows up multiple
times in the data file, so I want the first occurence, which isn't so
bad. What is getting me is how do I return the first occurence of a
line AFTER the first occurence of something else?
I imagine it may be easier to just right a subroutine to turn on a
flag, but I was hoping there was a one-liner type thing to do, so I
could learn something new.
Brian Andrus
expressions.
I want to parse a data file in perl to find a mac address of a
particular IP.
The format of the data file is something like:
lease 192.168.1.199 {
starts 1 2003/8/11 00:00:67;
ends 1 2003/08/11 00:05:67;
hardware ethernet 00:c0:f7:43:c0:25;
client-hostname "brad";
}
So I only want to return the line hardware ethernet IF it is enclosed
within the lease 192.168.1.199 set. Also that set shows up multiple
times in the data file, so I want the first occurence, which isn't so
bad. What is getting me is how do I return the first occurence of a
line AFTER the first occurence of something else?
I imagine it may be easier to just right a subroutine to turn on a
flag, but I was hoping there was a one-liner type thing to do, so I
could learn something new.
Brian Andrus