Assuming that the filename of the file you want to tail is file
and the filename of the list is list
. I also assume that the file list
looks like:
10.0.0.1 Hostname1 10.0.0.2 Hostname2
Then use this:
tail -f file | while read l; do \ while read i h; do l="$"; done <list; echo "$l"; \ done
- The
tail
command is piped to a while loop that reads the input line by line into the variable$l
. - Inside that while loop, there is another while loop that reads the file
list
line by line and replaces the values fromlist
in the$l
variable. - Then the line is printed to stdout.