Your mistake is that you do the check for "Link encap" string for both of the lines (first containing the interface name and second containing the address) while you need to do it only for the first line (as long as there is no "Link encap" in the line where the address is specified).
Do you understand this code?
In reply to Re^9: need to remove the extra line in regular expression
by aitap
in thread need to remove the extra line in regular expression
by ulaksh
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |