Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
以下のような行がたくさんあります。
PING planetlab2.tau.ac.il (192.114.4.3) 56(84) bytes of data.
(最初の行と)ペアの間にあるこれらの行から IP アドレスを取得したい
(
)
Linux正規表現を使用して取得する方法は? sed、grep、blabla のようにありがとう!
一致しない行が不要で、一致する行の IP アドレスのみが必要な場合は、次のようにしてください。
perl -ne 'print $1 if /\(((?:\d{1,3}\.){3}\d{1,3})\)/'<<EOT PING planetlab2.tau.ac.il (192.114.4.3) 56(84) bytes of data. EOT
出力:
192.114.4.3