in reply to Re^8: need to remove the extra line in regular expression
in thread need to remove the extra line in regular expression

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?

Sorry if my advice was wrong.
  • Comment on Re^9: need to remove the extra line in regular expression