On Wed, 24 Oct 2001, Paul Lussier wrote:
>>ifconfig $IFACE | perl -ne 'print "$1\n" if m/inet addr:([0-9.]*)/;'
>
> Or another variation on the same theme without the overhead of perl:

  I actually use "awk" in practice more often.  The Perl version I use above
has the advantage that it is not quite so sensitive to changes in the format
of the "ifconfig" output.  In particular, I dread what will happen to all
the people using 'awk -F: ...' when IPv6 becomes common.

>       ifconfig eth0 | perl -ne 'print "$1\n" if /addr:([0-9.]*)/;'

  That is even worse, since it will match IPX addresses, and who knows what
else.  :-)

-- 
Ben Scott <[EMAIL PROTECTED]>
| The opinions expressed in this message are those of the author and do not |
| necessarily represent the views or policy of any other person, entity or  |
| organization.  All information is provided without warranty of any kind.  |


**********************************************************
To unsubscribe from this list, send mail to
[EMAIL PROTECTED] with the following text in the
*body* (*not* the subject line) of the letter:
unsubscribe gnhlug
**********************************************************

Reply via email to