<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>mtiit</author_name>
  <author_url>https://blog.hatena.ne.jp/mtiit/</author_url>
  <blog_title>(O+P)ut</blog_title>
  <blog_url>https://www.mtioutput.com/</blog_url>
  <categories>
    <anon>UNIX</anon>
    <anon>UNIX-Linux</anon>
  </categories>
  <description>やりたいこと 以下のような文があるとして ef&amp;abc;gh&amp;と;で挟まれている箇所を&quot;A&quot;で置換して efAghとする。 環境情報 sed (GNU sed) 4.4 やり方 sedコマンドを用いて以下のように置換をかける。 $ sed -e 's/&amp;.*;/A/g'実際に置換をかけた結果は以下。 # echo &quot;ef&amp;abc;gh&quot; | sed -e 's/&amp;.*;/A/g' efAgh以下、補足です。 補足 任意の二つの文字で挟まれた箇所を切り取るワンライナーとなります。 例えば別の例として以下のような例でも、正常に動作していることが分かります。 $ echo &quot;abcdefghijkl…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fwww.mtioutput.com%2Fentry%2Fsed-replace-startstop&quot; title=&quot;【Bash/Linux/sed】開始文字と終了文字を与えてその部分を置換する - (O+P)ut&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url>https://cdn-ak.f.st-hatena.com/images/fotolife/m/mtiit/20190708/20190708105146.png</image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2024-02-04 16:53:38</published>
  <title>【Bash/Linux/sed】開始文字と終了文字を与えてその部分を置換する</title>
  <type>rich</type>
  <url>https://www.mtioutput.com/entry/sed-replace-startstop</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
