1

How I can to print only the list of the IP's ( in the end of the lines ) , from mount output

mount

 netapp64:/lunggg/OracleTeam/OracleCDs on /oracds type nfs (rw,fg,hard,nointr,nolock,rsize=32768,wsize=32768,tcp,nfsvers=3,timeo=60,addr=12.156.0.212)
 netapp74:/lunggg/qcdet_nfs on /applic/oradata/qcdev type nfs (rw,bg,hard,nolock,nointr,tcp,nfsvers=3,timeo=600,rsize=32768,wsize=368,addr=112.166.60.12)
 netapp23:/lunggg/qcts_nfs on /applic/oradata/qctst type nfs (rw,bg,hard,nolock,nointr,tcp,nfsvers=3,timeo=600,rsize=32768,wsize=368,addr=123.10.10.12)

example what I need to get:

12.156.0.212
112.166.60.12
123.10.10.12

remark - I think that IP from mount could be in different fields so need to capture the addr=xxx.xxx.xxx.xxx

3
  • 1
    mount | grep -Po '\baddr=\K[0-9.]{7,}'
    – Costas
    Feb 4, 2016 at 9:47
  • not get any output when I run this -:(
    – yael
    Feb 4, 2016 at 9:56
  • May I see mount | grep 'addr'
    – Costas
    Feb 4, 2016 at 12:31

1 Answer 1

0

You could use grep and cut:

~$ mount | egrep -o 'addr=[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | cut -d '=' -f 2

12.156.0.212
112.166.60.12
123.10.10.12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .