Pass stdin into Unix host or dig command

前端 未结 4 1693
悲&欢浪女
悲&欢浪女 2021-02-09 11:57

Let\'s say I have a list of IPs coming into a log that I\'m tailing:

1.1.1.1
1.1.1.2
1.1.1.3 

I\'d like to easily resolve them to host names. I

4条回答
  •  心在旅途
    2021-02-09 12:40

    In bash You can do:

    stdout | (dig -f <(cat))
    

    Example program:

    (
    cat <

    This way You only invoke 'dig' once.

提交回复
热议问题