Sunday, April 27, 2025

When you need the last 1MiB of a file.

MacOS/BSD doens't have the "head -c -1M" construct to get the last 1MiB of my file
filesize=$(stat -f %z main.log) && dd if=main.log bs=1 \ 
skip=$((filesize - 1048576)) > ~/chunk.log