$id=
sed '9s/^.*$/ subdomain: "aa"/' ngrok.conf
ngrok.conf第9行替换为 subdomain: "aa"
id=`/opt/sbt/sbtlinux/bin/cpuid`
echo $id
sed "9s/^.*$/ subdomain: \"$id\"/" ngrok.conf
PHP实现替换某一行
$file_path = '123.txt';
$content = file_get_contents($file_path);
//按换行符把全部内容分隔成数组
$con_array = explode("n", $content);
//替换掉指定行
$con_array[12]="123";
//组合回字符串
$con = implode("n", $con_array);
//写回文档
file_put_contents($file_path, $con);