ablog

不器用で落着きのない技術者のメモ

dig で IP アドレスだけを出力する

digコマンドに+shortオプションを指定して正引きするとIPアドレスだけを取得できます。

$ dig example.com +short
93.184.216.119

Understanding the dig commandで知りました。
dig(1): DNS lookup utility - Linux man pageでは

  1. [no]short

Provide a terse answer. The default is to print the answer in a verbose form.

としか書いてないです。
|

digでIPアドレスだけを出力する - Qiita