※macOSでのコマンド。linux系統で有効かはお試しください。
find . -type f -name "*.md" -newermt "2024-01-01" ! -newermt "2025-01-01" -print0 | xargs -0 cat | wc -m
-print0
: findコマンドの出力をヌル文字(\0)で区切る-newer[XY]
: XYを指定しつつ、引数に日付や時間を入れると範囲指定できるxargs -0
: ヌル文字をスペースなどとみなす的な役割らしい
man findより抜粋
-print0 This primary always evaluates to true. It prints the pathname of the current file to standard output, followed by an ASCII NUL character (character code 0).
-newerXY file True if the current file has a more recent last access time (X=a), inode creation time (X=B), change time (X=c), or modification time (X=m) than the last access time (Y=a), inode creation time (Y=B), change time (Y=c), or modification time (Y=m) of file. In addition, if Y=t, then file is instead interpreted as a direct date specification of the form understood by ISO8601 or RFC822. Note that -newermm is equivalent to -newer.
man xargsより抜粋
-0, --null Change xargs to expect NUL (``\0'') characters as separators, instead of spaces and newlines. This is expected to be used in concert with the -print0 function in find(1).
findの-print0 optionといっしょに使うもんらしい。
manに書いてあれば安心。
何度でも言う自戒
document読め!!!!!manを読め!!!!!!!