You may find the ``-oneline`` option to the ``ip`` command useful.  No need for possibly searching through multiple lines then since this stuff is normally line-buffered anyway.