Skip to content

Instantly share code, notes, and snippets.

@musan6363
Last active June 11, 2021 06:32
Show Gist options
  • Save musan6363/59e2a39987cb34c17d6de9112969c67a to your computer and use it in GitHub Desktop.
Save musan6363/59e2a39987cb34c17d6de9112969c67a to your computer and use it in GitHub Desktop.
対象のフォルダ下にあるテキストファイルを走査し,エラー出力をまとめる.またエラー出力のあったフォルダをまとめる.
#!/bin/bash
# 全てのファイルのエラー出力をまとめる
target="~/Documents/OpenFace/210610"
# すでに書き出し先のファイルが有れば消す.
if [ -e all_error.csv ]; then
rm -rf all_error.csv
fi
if [ -e killed.txt ]; then
rm -rf killed.txt
fi
for folder in $(find ${target} -name "id*" -type d -maxdepth 1); do
echo ${folder##*/}
error=`cat ${folder}/error.txt`
echo "${folder##*/}, ${error}" >> all_error.csv
# 失敗した動画のリストを作成
if [ -s ${folder}/error.txt ]; then
echo ${folder##*/} >> killed.txt
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment