<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[刘新修]]></title> 
<link>http://liuxinxiu.com:80/index.php</link> 
<description><![CDATA[刘新修的个人博客 (Liuxinxiu'S Blog)]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[刘新修]]></copyright>
<item>
<link>http://liuxinxiu.com:80/s//</link>
<title><![CDATA[shell(bash)替换字符串大全]]></title> 
<author>刘新修 &lt;admin@yourname.com&gt;</author>
<category><![CDATA[Linux/Unix]]></category>
<pubDate>Wed, 16 Aug 2023 03:13:34 +0000</pubDate> 
<guid>http://liuxinxiu.com:80/s//</guid> 
<description>
<![CDATA[ 
	<h3 style="box-sizing: border-box; outline: 0px; padding: 0px; font-family: &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, SimHei, Arial, SimSun; font-size: 18px; color: rgb(79, 79, 79); line-height: 28px; overflow-wrap: break-word; font-variant-ligatures: no-common-ligatures;">1. 替换（只替换一个）</h3><p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(77, 77, 77); line-height: 26px; overflow: auto hidden; overflow-wrap: break-word; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif; font-variant-ligatures: no-common-ligatures;">用<code style="box-sizing: border-box; outline: 0px; font-family: &quot;Source Code Pro&quot;, &quot;DejaVu Sans Mono&quot;, &quot;Ubuntu Mono&quot;, &quot;Anonymous Pro&quot;, &quot;Droid Sans Mono&quot;, Menlo, Monaco, Consolas, Inconsolata, Courier, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif; font-size: 14px; line-height: 22px; color: rgb(199, 37, 78); background-color: rgb(249, 242, 244); border-radius: 2px; padding: 2px 4px; overflow-wrap: break-word;">varrB=$&#123;varA/str1/str2&#125;</code></p><div class="codeText"><div class="codeHead">C#代码</div><ol start="1" class="dp-c"><li class="alt"><span><span>$ var=</span><span class="string">&quot;AAAszip_BBB.zip&quot;</span><span>;var2=$&#123;var/zip/ZIP&#125;;echo $var2&#125;;&nbsp;&nbsp;</span></span></li><li><span>AAAsZIP_BBB.zip&nbsp;&nbsp;</span></li><li class="alt"><span>$ var=<span class="string">&quot;AAAszip_BBB.zip&quot;</span><span>;var2=$&#123;var/.zip/.ZIP&#125;;echo $var2;&nbsp;&nbsp;</span></span></li><li><span>AAAszip_BBB.ZIP&nbsp;&nbsp;</span></li></ol></div><h3 style="box-sizing: border-box; outline: 0px; margin: 24px 0px 8px; padding: 0px; font-family: &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, SimHei, Arial, SimSun; font-size: 18px; color: rgb(79, 79, 79); line-height: 28px; overflow-wrap: break-word; font-variant-ligatures: no-common-ligatures;">2. 替换（替换所有）</h3><p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(77, 77, 77); line-height: 26px; overflow: auto hidden; overflow-wrap: break-word; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif; font-variant-ligatures: no-common-ligatures;">用<code style="box-sizing: border-box; outline: 0px; font-family: &quot;Source Code Pro&quot;, &quot;DejaVu Sans Mono&quot;, &quot;Ubuntu Mono&quot;, &quot;Anonymous Pro&quot;, &quot;Droid Sans Mono&quot;, Menlo, Monaco, Consolas, Inconsolata, Courier, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif; font-size: 14px; line-height: 22px; color: rgb(199, 37, 78); background-color: rgb(249, 242, 244); border-radius: 2px; padding: 2px 4px; overflow-wrap: break-word;">varB=$&#123;varA//str1/str2&#125;</code></p><div class="codeText"><div class="codeHead">C#代码</div><ol start="1" class="dp-c"><li class="alt"><span><span>$ var=</span><span class="string">&quot;AAAszip_BBB.zip&quot;</span><span>;var2=$&#123;var</span><span class="comment">//zip/ZIP&#125;;echo $var2;</span><span>&nbsp;&nbsp;</span></span></li><li><span>AAAsZIP_BBB.ZIP&nbsp;&nbsp;</span></li></ol></div><h3 style="box-sizing: border-box; outline: 0px; margin: 24px 0px 8px; padding: 0px; font-family: &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, SimHei, Arial, SimSun; font-size: 18px; color: rgb(79, 79, 79); line-height: 28px; overflow-wrap: break-word; font-variant-ligatures: no-common-ligatures;">3. 替换（替换开头一个）</h3><p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(77, 77, 77); line-height: 26px; overflow: auto hidden; overflow-wrap: break-word; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif; font-variant-ligatures: no-common-ligatures;">用<code style="box-sizing: border-box; outline: 0px; font-family: &quot;Source Code Pro&quot;, &quot;DejaVu Sans Mono&quot;, &quot;Ubuntu Mono&quot;, &quot;Anonymous Pro&quot;, &quot;Droid Sans Mono&quot;, Menlo, Monaco, Consolas, Inconsolata, Courier, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif; font-size: 14px; line-height: 22px; color: rgb(199, 37, 78); background-color: rgb(249, 242, 244); border-radius: 2px; padding: 2px 4px; overflow-wrap: break-word;">varB=$&#123;varA/#str1/str2&#125;</code></p><div class="codeText"><div class="codeHead">C#代码</div><ol start="1" class="dp-c"><li class="alt"><span><span>$ var=</span><span class="string">&quot;.zipAAAszip_BBB.zip_CCC&quot;</span><span>;var2=$&#123;var/#.zip/.ZIP&#125;;echo $var2;&nbsp;&nbsp;</span></span></li><li><span>.ZIPAAAszip_BBB.zip_CCC&nbsp;&nbsp;</span></li></ol></div><p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(77, 77, 77); line-height: 26px; overflow: auto hidden; overflow-wrap: break-word; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif; font-variant-ligatures: no-common-ligatures;">不存在<br style="box-sizing: border-box; outline: 0px; overflow-wrap: break-word;" /><code style="box-sizing: border-box; outline: 0px; font-family: &quot;Source Code Pro&quot;, &quot;DejaVu Sans Mono&quot;, &quot;Ubuntu Mono&quot;, &quot;Anonymous Pro&quot;, &quot;Droid Sans Mono&quot;, Menlo, Monaco, Consolas, Inconsolata, Courier, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif; font-size: 14px; line-height: 22px; color: rgb(199, 37, 78); background-color: rgb(249, 242, 244); border-radius: 2px; padding: 2px 4px; overflow-wrap: break-word;">varB=$&#123;varA//#str1/str2&#125;</code></p><h3 style="box-sizing: border-box; outline: 0px; margin: 24px 0px 8px; padding: 0px; font-family: &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, SimHei, Arial, SimSun; font-size: 18px; color: rgb(79, 79, 79); line-height: 28px; overflow-wrap: break-word; font-variant-ligatures: no-common-ligatures;"><a name="t4" style="box-sizing: border-box; outline: none; margin: 0px; padding: 0px; font-weight: normal; cursor: pointer; background-color: transparent; color: rgb(78, 161, 219); overflow-wrap: break-word;"></a>4. 替换（替换结尾一个）</h3><p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(77, 77, 77); line-height: 26px; overflow: auto hidden; overflow-wrap: break-word; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif; font-variant-ligatures: no-common-ligatures;">用<code style="box-sizing: border-box; outline: 0px; font-family: &quot;Source Code Pro&quot;, &quot;DejaVu Sans Mono&quot;, &quot;Ubuntu Mono&quot;, &quot;Anonymous Pro&quot;, &quot;Droid Sans Mono&quot;, Menlo, Monaco, Consolas, Inconsolata, Courier, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif; font-size: 14px; line-height: 22px; color: rgb(199, 37, 78); background-color: rgb(249, 242, 244); border-radius: 2px; padding: 2px 4px; overflow-wrap: break-word;">varB=$&#123;varA/%str1/str2&#125;</code></p><div class="codeText"><div class="codeHead">C#代码</div><ol start="1" class="dp-c"><li class="alt"><span><span>$ var=</span><span class="string">&quot;AAAszip_BBB.zip_CCC.zip&quot;</span><span>;var2=$&#123;var/%.zip/.ZIP&#125;;echo $var2;&nbsp;&nbsp;</span></span></li><li><span>AAAszip_BBB.zip_CCC.ZIP&nbsp;&nbsp;</span></li></ol></div><p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(77, 77, 77); line-height: 26px; overflow: auto hidden; overflow-wrap: break-word; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif; font-variant-ligatures: no-common-ligatures;">不存在<br style="box-sizing: border-box; outline: 0px; overflow-wrap: break-word;" /><code style="box-sizing: border-box; outline: 0px; font-family: &quot;Source Code Pro&quot;, &quot;DejaVu Sans Mono&quot;, &quot;Ubuntu Mono&quot;, &quot;Anonymous Pro&quot;, &quot;Droid Sans Mono&quot;, Menlo, Monaco, Consolas, Inconsolata, Courier, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif; font-size: 14px; line-height: 22px; color: rgb(199, 37, 78); background-color: rgb(249, 242, 244); border-radius: 2px; padding: 2px 4px; overflow-wrap: break-word;">varB=$&#123;varA//%str1/str2&#125;</code></p><p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(77, 77, 77); line-height: 26px; overflow: auto hidden; overflow-wrap: break-word; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif; font-variant-ligatures: no-common-ligatures;">而且可以很好地匹配到&ldquo;.&rdquo;点号</p><h3 style="box-sizing: border-box; outline: 0px; margin: 24px 0px 8px; padding: 0px; font-family: &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, SimHei, Arial, SimSun; font-size: 18px; color: rgb(79, 79, 79); line-height: 28px; overflow-wrap: break-word; font-variant-ligatures: no-common-ligatures;"><a name="t5" style="box-sizing: border-box; outline: none; margin: 0px; padding: 0px; font-weight: normal; cursor: pointer; background-color: transparent; color: rgb(78, 161, 219); overflow-wrap: break-word;"></a>5. 截取，删除右边，保留左边，从右起最短匹配</h3><p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(77, 77, 77); line-height: 26px; overflow: auto hidden; overflow-wrap: break-word; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif; font-variant-ligatures: no-common-ligatures;">用<code style="box-sizing: border-box; outline: 0px; font-family: &quot;Source Code Pro&quot;, &quot;DejaVu Sans Mono&quot;, &quot;Ubuntu Mono&quot;, &quot;Anonymous Pro&quot;, &quot;Droid Sans Mono&quot;, Menlo, Monaco, Consolas, Inconsolata, Courier, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif; font-size: 14px; line-height: 22px; color: rgb(199, 37, 78); background-color: rgb(249, 242, 244); border-radius: 2px; padding: 2px 4px; overflow-wrap: break-word;">$varB=$&#123;varAa%&lt;pattern&gt;&#125;</code>，</p><div class="codeText"><div class="codeHead">C#代码</div><ol start="1" class="dp-c"><li class="alt"><span><span>$ a=</span><span class="string">&quot;aaa=bbb&quot;</span><span>;b=$&#123;a%=*&#125;;echo $b&nbsp;&nbsp;</span></span></li><li><span>aaa&nbsp;&nbsp;</span></li><li class="alt"><span>$ a=<span class="string">&quot;http://localhost:3000/china/shanghai.html&quot;</span><span>;b=$&#123;a%/*&#125;;echo $b&nbsp;&nbsp;</span></span></li><li><span>http:<span class="comment">//localhost:3000/china</span><span>&nbsp;&nbsp;</span></span></li></ol></div><h3 style="box-sizing: border-box; outline: 0px; margin: 24px 0px 8px; padding: 0px; font-family: &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, SimHei, Arial, SimSun; font-size: 18px; color: rgb(79, 79, 79); line-height: 28px; overflow-wrap: break-word; font-variant-ligatures: no-common-ligatures;">6. 截取，删除右边，保留左边，从右起最长匹配</h3><p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(77, 77, 77); line-height: 26px; overflow: auto hidden; overflow-wrap: break-word; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif; font-variant-ligatures: no-common-ligatures;">用<code style="box-sizing: border-box; outline: 0px; font-family: &quot;Source Code Pro&quot;, &quot;DejaVu Sans Mono&quot;, &quot;Ubuntu Mono&quot;, &quot;Anonymous Pro&quot;, &quot;Droid Sans Mono&quot;, Menlo, Monaco, Consolas, Inconsolata, Courier, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif; font-size: 14px; line-height: 22px; color: rgb(199, 37, 78); background-color: rgb(249, 242, 244); border-radius: 2px; padding: 2px 4px; overflow-wrap: break-word;">$varb=$&#123;vara%%&lt;pattern&gt;&#125;</code>从右起最长匹配</p><div class="codeText"><div class="codeHead">C#代码</div><ol start="1" class="dp-c"><li class="alt"><span><span>$ a=</span><span class="string">&quot;http://localhost:3000/china/shanghai.html&quot;</span><span>;b=$&#123;a%%/*&#125;;echo $b&nbsp;&nbsp;</span></span></li><li><span>http:&nbsp;&nbsp;</span></li></ol></div><h3 style="box-sizing: border-box; outline: 0px; margin: 24px 0px 8px; padding: 0px; font-family: &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, SimHei, Arial, SimSun; font-size: 18px; color: rgb(79, 79, 79); line-height: 28px; overflow-wrap: break-word; font-variant-ligatures: no-common-ligatures;">7. 截取，删除左边，保留右边，从左起最短匹配</h3><p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(77, 77, 77); line-height: 26px; overflow: auto hidden; overflow-wrap: break-word; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif; font-variant-ligatures: no-common-ligatures;">用<code style="box-sizing: border-box; outline: 0px; font-family: &quot;Source Code Pro&quot;, &quot;DejaVu Sans Mono&quot;, &quot;Ubuntu Mono&quot;, &quot;Anonymous Pro&quot;, &quot;Droid Sans Mono&quot;, Menlo, Monaco, Consolas, Inconsolata, Courier, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif; font-size: 14px; line-height: 22px; color: rgb(199, 37, 78); background-color: rgb(249, 242, 244); border-radius: 2px; padding: 2px 4px; overflow-wrap: break-word;">$varb=$&#123;vara#&lt;pattern&gt;&#125;</code></p><div class="codeText"><div class="codeHead">C#代码</div><ol start="1" class="dp-c"><li class="alt"><span><span>$ a=</span><span class="string">&quot;aaa=bbb&quot;</span><span>;b=$&#123;a#*=&#125;;echo $b&nbsp;&nbsp;</span></span></li><li><span>bbb&nbsp;&nbsp;</span></li><li class="alt"><span>$ a=<span class="string">&quot;http://localhost:3000/china/shanghai.html&quot;</span><span>;b=$&#123;a#*/&#125;;echo $b&nbsp;&nbsp;</span></span></li><li><span>/localhost:3000/china/shanghai.html&nbsp;&nbsp;</span></li></ol></div><h3 style="box-sizing: border-box; outline: 0px; margin: 24px 0px 8px; padding: 0px; font-family: &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, SimHei, Arial, SimSun; font-size: 18px; color: rgb(79, 79, 79); line-height: 28px; overflow-wrap: break-word; font-variant-ligatures: no-common-ligatures;">8. 截取，删除左边，保留右边，从左起最长匹配</h3><p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(77, 77, 77); line-height: 26px; overflow: auto hidden; overflow-wrap: break-word; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif; font-variant-ligatures: no-common-ligatures;">用<code style="box-sizing: border-box; outline: 0px; font-family: &quot;Source Code Pro&quot;, &quot;DejaVu Sans Mono&quot;, &quot;Ubuntu Mono&quot;, &quot;Anonymous Pro&quot;, &quot;Droid Sans Mono&quot;, Menlo, Monaco, Consolas, Inconsolata, Courier, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif; font-size: 14px; line-height: 22px; color: rgb(199, 37, 78); background-color: rgb(249, 242, 244); border-radius: 2px; padding: 2px 4px; overflow-wrap: break-word;">$varb=$&#123;vara##&lt;pattern&gt;&#125;</code>从左起最长匹配</p><div class="codeText"><div class="codeHead">C#代码</div><ol start="1" class="dp-c"><li class="alt"><span><span>$ a=</span><span class="string">&quot;http://localhost:3000/china/shanghai.html&quot;</span><span>;b=$&#123;a##*/&#125;;echo $b&nbsp;&nbsp;</span></span></li><li><span>shanghai.html&nbsp;&nbsp;</span></li></ol></div>
]]>
</description>
</item><item>
<link>http://liuxinxiu.com:80/s//#blogcomment</link>
<title><![CDATA[[评论] shell(bash)替换字符串大全]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>http://liuxinxiu.com:80/s//#blogcomment</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>