Skip to content

Instantly share code, notes, and snippets.

@object1985
Created July 26, 2021 05:35
Show Gist options
  • Save object1985/e390333cf0b3c15a6765faabd78152ee to your computer and use it in GitHub Desktop.
Save object1985/e390333cf0b3c15a6765faabd78152ee to your computer and use it in GitHub Desktop.
Linuxコマンドでテキストファイル内に記載したファイルを順次処理
# Windows の WSL-Ubuntu での利用を想定。
# テキストファイル内に処理対象のファイルの絶対パスを記載し、1行1行処理していく。
# 処理結果をcheck.txtへ追記。
# 以下の例では6行目のみを抽出。
for f in `cat /mnt/c/sample/target.txt`; do echo $f; echo $f >> check.txt; head -n6 $f | tail -n1 >> check.txt; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment