0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

joを使ってファイル一覧のJSONをつくる

Last updated at Posted at 2017-09-26

背景

友達から依頼されました。
サーバ関係でカレントディレクトリにある全ファイルを、拡張子ごとに分類したJSONをつくって欲しいとのことでした。
joを使います。

joのインストール

brew install jo

プログラム

for type in $(ls -F | grep -v / | grep -oE '\..*' | sort | uniq);do echo $type=$(ls *$type | awk '{print NR "=" $0}' | jo);done | jo -p

実行結果

スクリーンショット 2017-09-27 1.24.48.png
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?