I am piping information to a file using myTool > file.txt 2>&1
, but the tool might generate GigaBytes worth of data - I need to cut off after the first N bytes, let say 2MB.
It seems pv
can not do that, and sadly it is not an option to go by lines (head
).
Is there no basic tool to do this?
Ideally, it would work like this: myTool | limiter --amount 2M > file.txt 2>&1
.
head
can do bytes, too - which flavor are you using?dd bs=2M count=1
?