Re: using grep to find IP address...
From: Thorn (Raptor_at_Etruscan.Warrior)
Date: 05/31/05
- Next message: linq936_at_hotmail.com: "bash : how to redirect both stdout and stderr to append a file"
- Previous message: Greg Beeker: "Re: using grep to find IP address..."
- In reply to: balgach_at_gmail.com: "using grep to find IP address..."
- Next in thread: Ed Morton: "Re: using grep to find IP address..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 31 May 2005 11:00:57 -0500
On 31 May 2005 08:30:41 -0700, balgach@gmail.com Cried: Read These Runes!:
> Hello all, i am interested in the last 255 bits of the local machines
> ip address (aka the last number after the period) so far ive been
> using the command, i know all the ip address start with 192.168
>
> ifconfig | grep '192.168' | awk '{print $2}'
>
> which is returning:
>
> inet addr:192.168.0.20
>
>
> now how do i get it just to return the '20' ??
There's got to be an easier way:
/sbin/ifconfig | grep inet | cut -d . -f 4 | cut -d " " -f 1
Thorn
-- "I am not sure what this is, but an `F' would only dignify it." -- English Professor
- Next message: linq936_at_hotmail.com: "bash : how to redirect both stdout and stderr to append a file"
- Previous message: Greg Beeker: "Re: using grep to find IP address..."
- In reply to: balgach_at_gmail.com: "using grep to find IP address..."
- Next in thread: Ed Morton: "Re: using grep to find IP address..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|