假设我有文件:index.html
index.html
<p class="p">This
entry will determine the number of transmit threads, each channel
represents one thread, which can handle multiple multicast ports.
All channels are enabled by default. To temporarily disable a particular
channel, use the folowing configuration lines:</p>
如何仅在
标记内将换行符替换为空格
例如,将index.html更改为:
<p class="p">This entry will determine the number of transmit threads, each channel represents one thread, which can handle multiple multicast ports. All channels are enabled by default. To temporarily disable a particular channel, use the folowing configuration lines:</p>`
尝试过,
sed -e "/<p>/s/\n/ /g" index.html
不工作
最佳答案
使用gnu-sed
:
sed -E '/<p class="p">/{:a; N; s/\n/ /g; /<\/p>/!ba;}' index.html
关于linux - sed:用空格替换 <p> </p> 中的换行符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/74859884/