Linux + mountコマンドでのみIPキャプチャ

Linux + mountコマンドでのみIPキャプチャ

インストール出力からIPリスト(行末)のみを印刷するにはどうすればよいですか?

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)

たとえば、私が得る必要があるのは次のとおりです。

12.156.0.212
112.166.60.12
123.10.10.12

注 - マウントされたIPが別のフィールドにある可能性があるため、addr = xxx.xxx.xxx.xxxをキャプチャする必要があります。

ベストアンサー1

grep以下を使用できます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

おすすめ記事