digコマンドに+shortオプションを指定して正引きするとIPアドレスだけを取得できます。
$ dig example.com +short 93.184.216.119Understanding the dig commandで知りました。
dig(1): DNS lookup utility - Linux man pageでは
- [no]short
Provide a terse answer. The default is to print the answer in a verbose form.
としか書いてないです。
digでIPアドレスだけを出力する - Qiita
|