The sed command suggested in the last comment may not be completely
reliable and portable. I've found that sed works differently in some
cases with respect to regex patterns and so forth. The command doesn't
work on my laptop, for example.
Perl might actually be a better tool for this case:
The sed command suggested in the last comment may not be completely
reliable and portable. I've found that sed works differently in some
cases with respect to regex patterns and so forth. The command doesn't
work on my laptop, for example.
Perl might actually be a better tool for this case:
/sbin/ifconfig | perl -e while(< >){$_!~ m/LOOPBACK/ &&/UP.* RUNNING/ &&s/^.* addr:(\ S+).*$/ $1/s&&print
'$/="";
$_, "\n"}'