From 1e2f2e68286ce018c57945ab3cdcbaaf484377ee Mon Sep 17 00:00:00 2001 From: nsfisis Date: Wed, 9 Apr 2025 20:28:28 +0900 Subject: feat(blog/content): convert from .ndoc to .dj --- .../zip-function-like-command-paste-command.ndoc | 111 --------------------- 1 file changed, 111 deletions(-) delete mode 100644 vhosts/blog/content/posts/2025-03-27/zip-function-like-command-paste-command.ndoc (limited to 'vhosts/blog/content/posts/2025-03-27/zip-function-like-command-paste-command.ndoc') diff --git a/vhosts/blog/content/posts/2025-03-27/zip-function-like-command-paste-command.ndoc b/vhosts/blog/content/posts/2025-03-27/zip-function-like-command-paste-command.ndoc deleted file mode 100644 index 3419099b..00000000 --- a/vhosts/blog/content/posts/2025-03-27/zip-function-like-command-paste-command.ndoc +++ /dev/null @@ -1,111 +0,0 @@ ---- -[article] -uuid = "99111377-27e7-427b-9dc5-a23f621fa826" -title = "zip 関数のようなコマンド paste" -description = "zip 関数のような動きをする paste コマンドについてのメモ。" -tags = [ - "note-to-self", -] - -[[article.revisions]] -date = "2021-03-22" -remark = "デジタルサーカス株式会社の社内記事として公開" -isInternal = true - -[[article.revisions]] -date = "2025-03-27" -remark = "ブログ記事として一般公開" ---- -
- - この記事は、2021-03-22 にデジタルサーカス株式会社 の社内 Qiita Team に公開された記事をベースに、加筆修正して一般公開したものです。 - -
- 実現したい内容 -

- 次の2ファイル a.txt / b.txt から出力 ab.txt を得たい。 -

-

- a.txt -

- - - -

- b.txt -

- - - -

- ab.txt -

- - - -

- ちょうど Python や Haskell などにある zip 関数のような動きをさせたい。 -

-
-
- 実現方法 -

- 記事タイトルに書いたように、paste コマンドを使うと実現できる。 -

- - ab.txt - ]]> - -

- paste コマンドは複数のファイルを引数に取り、それらを1行ずつ消費しながら -d で指定した文字で区切って出力する。 - -d は区切り文字の指定で、デフォルトだとタブ区切りになる。 -

-

- ファイル名には - を指定でき、その場合は標準入力から読み込んで出力する。 - このとき paste - - のように複数回 - を指定すると、指定した回数の行ごとに連結することができる。 - 例えば ab.txt だとこうなる。 -

- - - -

- これは標準入力を使うとき特有の挙動で、単に同じファイル名を指定してもこうはならない。 -

- - - -

- ときどき便利。 -

-
-
-- cgit v1.2.3-70-g09d2