文件换行输入和清空
cat > /etc/security/limits.conf<< EOF
* soft nproc 16384
* hard nproc 16384
* soft nofile 1048576
* hard nofile 1048576
* soft stack 10240
* hard stack 32768
* hard memlock 8000000
* soft memlock 8000000
EOF
echo -ne "
* soft nofile 65536
* hard nofile 65536
" >>/etc/security/limits.conf
cat /dev/null > /etc/security/limits.conf
cat >> a.txt << EOF
<ads_cluster1>
<shard>
<internal_replication>true</internal_replication>
<replica>
<default_database>shard1_ads</default_database>
<host>10.0.12.14</host>
<port>19000</port>
<user>default</user>
<password>eb22d98eaf028b1ca5c36548193d604a</password>
</replica>
<replica>
<default_database>shard1_ads</default_database>
<host>10.0.12.15</host>
<port>19000</port>
<user>default</user>
<password>eb22d98eaf028b1ca5c36548193d604a</password>
</replica>
<replica>
<default_database>shard1_ads</default_database>
<host>10.0.12.17</host>
<port>19000</port>
<user>default</user>
<password>eb22d98eaf028b1ca5c36548193d604a</password>
</replica>
</shard>
</ads_cluster1>
EOF
sed -i '$d' config.xml
cat >> config.xml << EOF
<distributed_ddl>
<path>/clickhouse/task_queue/ddl</path>
</distributed_ddl>
</yandex>
EOF
echo -e ' <distributed_ddl>\n <path>/clickhouse/task_queue/ddl</path>\n </distributed_ddl>\n</yandex>' >> config.xml
sed -i '55 r a.txt' metrika.xml
cat -n metrika.xml
sed -i '108,111d' metrika.xml
rm -f a.txt