Append Hostname to tail -F
Hello Everyone,
I'm trying to append the host name and the file name to every line of tail -f output. Used tail -v to retrieve the file name , is there anyway to append the host name as well ? Thanks |
Not sure if this is exactly what you asked for, but it might be a step in the right direction. You can use the find command to select the files to be tailed (in my example, *.txt), and use multiple -exec statements to get the desired output:
Code:
find . -maxdepth 1 -name '*.txt' -exec echo -e "\n" host=$(uname -n) file={} \; -exec tail {} \; |
All times are GMT -5. The time now is 07:11 PM. |