Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
いくつかのデータを含むファイルがたくさんあるフォルダがあります。すべてのファイルに完全なデータセットがあるわけではありません。完全なデータセットはすべて、最後の行に「yyyy-mm-dd」という形式の共通の文字列があるため、のようなものでフィルタリングできると思いましtail -n 1たが、その方法がわかりません。
tail -n 1
単純なスクリプトまたはbashコマンドでそのようなことを行う方法はありますか?
for f in * do tail -n 1 "$f" | grep -qE '^[0-9]{4}-[01][0-9]-[0-3][0-9]$' && echo "$f" done