<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>matsu7874</author_name>
  <author_url>https://blog.hatena.ne.jp/matsu7874/</author_url>
  <blog_title>matsu7874のブログ</blog_title>
  <blog_url>https://matsu7874.hatenablog.com/</blog_url>
  <categories>
    <anon>Bash</anon>
  </categories>
  <description>Bashで文字列の差集合を求める関数を実装しました。 結構つまりながら実装したのでブログに書いておきます。 考え方 集合Aと集合Bの積集合（共通要素の集合）を求める。 集合Aと「1. 集合Aと集合Bの積集合」で重複していない要素を求める。 実装 except() { # 文字列を集合と見たときの差集合`a - b`を返す local a b intersection difference a=$1 b=$2 intersection=($(for item in ${a} ${b}; do echo &quot;$item&quot;; done | sort | uniq -d)) difference=($(…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fmatsu7874.hatenablog.com%2Fentry%2F2018%2F09%2F16%2F230822&quot; title=&quot;Bashで配列の積集合・差集合を求める - matsu7874のブログ&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></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2018-09-16 23:08:22</published>
  <title>Bashで配列の積集合・差集合を求める</title>
  <type>rich</type>
  <url>https://matsu7874.hatenablog.com/entry/2018/09/16/230822</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
