[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: awk or sed?



On Thu, Sep 23, 1999 at 12:12:57PM +1200, Tim Thomson wrote:
> Hi,
> 
> I want to write a script, that gets the local ip address, and does a
> reverse ns lookup, then sets the hostname to the dns response.

The Trinity OS uses these lines to get the IP and the Point-to-Point peer (if any)

where EXTIF is the interface

EXTIP=`/sbin/ifconfig | grep -A 4 $EXTIF | awk '/inet/ { print $2 } ' | sed -e s/addr://`
PTPPP=`/sbin/ifconfig | grep -A 4 $EXTIF | awk '/P-t-P/ { print $3 } ' | sed -e s/P-t-P://`


HTH

-- 
Weasel                         http://www.cosy.sbg.ac.at/~ppalfrad/
PGP encrypted messages prefered.  See my site or finger -l ppalfrad
-------------------------------------------------------------------
     A friend is someone who knows the song in your heart and
    can sing it back to you when you have forgotten the words.

Attachment: pgpPPyiJ1cWoB.pgp
Description: PGP signature


Reply to: