crie o novo arquivo newcontent.txt. colocando o conteúdo que você deseja substituir.
Cat new content.txt
<function name="configure" type="test" username="user1" num="1" Mode="YA" Type="WPA2-PSK" txt="NA-TO" TextType="guest" who="BANANNA">
<parameters name="_key" value="password" isit="true" />
</function>
Use o comando abaixo para obter o conteúdo substituído de acordo com sua exigência
sed '5r newcontent.txt' example2.txt | sed ‘5d'.
example2.txt == > arquivo de entrada original
newcontent.txt == > Consiste em conteúdo que precisa ser substituído
Saída
<?xml version="1.0" encoding="UTF-8"?>
<TestConfig xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Text>
<Checking state="BOOT" />
<function name="configure" type="test" username="user1" num="1" Mode="YA" Type="WPA2-PSK" txt="NA-TO" TextType="guest" who="BANANNA">
<parameters name="_key" value="password" isit="true" />
</function>
<function name="configure" type="test" username="user2" num="2" Mode="YA" Type="DYNAMIC-WEP" txt="NA-TO" TextType="employee" who="BANANNA" />
<function name="configure" type="test" username="user3" num="3" Mode="YA" Type="DYNAMIC-WEP" txt="NA-TO" TextType="employee" who="BANANNA"/>
<function name="configure" type="test" username="user4" num="4" Mode="YA" Type="WPA2-PSK" txt="CA-TO" TextType="employee" who="BANANNA">
<parameters name="_key" value="password" isit="true" />
</function>
<function name="configure" type="test" username="user5" num="5" Mode="YA" Type="WPA2-PSK" txt="CA-TO" TextType="employee" who="BANANNA">
<parameters name="_key" value="password" isit="true" />
</function>
<function name="configure" type="test" username="user6" num="7" Mode="YA" Type="WPA2-PSK" TextType="employee" who="BANANNA">
<parameters name="_key" value="password" isit="true" />
</function>
</Text>
</TestConfig>