#!/bin/bash

s="[IP] 192.168.1.0"
ip="192.168.15.24"
sed "s/^\[IP] .*/[IP] $ip/" <<< "$s"