Você pode usar isto:
sed -i "s/allow from [0-9,\.]*/allow from $(w -h | awk '{print $3}' | head -1)/g" .htaccess
Explicação:
-
sed -i "s/.../$(...)/g .htaccess: substitui a linhaallow frompor -
w -h | awk '{print $3}' | head -1: a primeira linha da saída dew