<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>nae3na</author_name>
  <author_url>https://blog.hatena.ne.jp/nae3na/</author_url>
  <blog_title>なえ箱</blog_title>
  <blog_url>https://nae3na.hatenablog.com/</blog_url>
  <categories>
    <anon>sh</anon>
  </categories>
  <description>シェルスクリプトを使い始めてみたのでメモ書きついでに。 もっといい書き方とかあったら教えてください。 ファイルの中身を1行ずつ配列に入れて、x番目の要素を取り出せないかなーと思ったのでやってみた。 こんな感じのテキストファイルがあったら hoge ho ge fuga fu ga IFSの区切り文字を改行だけに設定して、 file.txtの中身を配列fileに入れる。 あとは${file[x]}でxに取りたいところの数字を入れれば要素が取れた。 IFS=$'\n'; file=(`cat file.txt`) echo ${file[3]} #↑3番目要素が表示される(fuga) forで行ご…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fnae3na.hatenablog.com%2Fentry%2Farchives%2F292&quot; title=&quot;ファイルの中身を1行ずつ配列に入れる - なえ箱&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.blog.st-hatena.com/images/theme/og-image-1500.png</image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2019-06-22 09:00:48</published>
  <title>ファイルの中身を1行ずつ配列に入れる</title>
  <type>rich</type>
  <url>https://nae3na.hatenablog.com/entry/archives/292</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
