file=`cat file`
echo "------- file -------"
echo "$file"
template="'cluster' => 'Cluster',"
replaceTo="$template\\
'version' => '1.0'"
result=`echo "$file" | sed 's/'"$template"'/'"$replaceTo"'/g'`
echo "------- result -------"
echo "$result"
Результат выполнения:
------- file -------
"server" => [
{
"port" => "2200",
"ntf_port" => "22000",
"ip" => "10.10.10.10",
'role' => 'Client',
'cluster' => 'Cluster',
'ntf_sync' => true,
}
------- result -------
"server" => [
{
"port" => "2200",
"ntf_port" => "22000",
"ip" => "10.10.10.10",
'role' => 'Client',
'cluster' => 'Cluster',
'version' => '1.0',
'ntf_sync' => true,
}