awk '{n=split($1,array,"*"); for (i=3;i<=NF;i++) {print $i >array[1]}}' input
The above uses whitespace as a field separator. Consequently, for your first example line, the first field is host1*stop*start
, the second is :
, and the rest are: runit
, stopit
, gather
. We first need to extract the hostname from the the first field. We do this by splitting that field on the character *
which puts the hostname in the variable array[1]
. Then, we write the third field and all thereafter as separate lines to the file named by array[1]
.