N
N
nallion2015-12-09 21:42:17
linux
nallion, 2015-12-09 21:42:17

How to get p-to-p IP address in bash script?

There is a task
[email protected]:/# ifconfig ppp0
ppp0 Link encap:Point-to-Point Protocol
inet addr:46.98.155.191 PtP:212.115.225.241 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1492 Metric:1
RX packets: 12856544 errors:0 dropped:0 overruns:0 frame:0
TX packets:9236144 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:3
RX bytes:14388430097 (13.4 GiB) TX bytes:4112806872 (3.8 GiB )
[email protected]:/# ifconfig ppp0 | awk -F ' *|:' '/inet addr/{print $4}'
46.98.155.191
how to get ptp address?
tried
[email protected]:/# ifconfig ppp0 | awk -F '*| :' '/inet addr/{print $4}'
PtP:212.115.225.241
but the exhaust contains extra ptp
how to remove them?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vladimir Zhurkin, 2015-12-09
@icCE

ip addr show ppp0 | awk '/inet/ {print $2}'

M
morgan, 2015-12-10
@morgane

Nice try, Comrade Major.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question