0

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.

4
  • 2
    usually head can do bytes, too - which flavor are you using? May 9 at 21:10
  • @frostschutz It seems I simply overlooked this! Coreutils 8.32. If you post this as an answer, I'll accept it - thank you for pointing out the (seemingly) obvious! May 9 at 21:22
  • @cyrus, I can't comment on your answer: couldn't you just switch the numbers? dd bs=2M count=1? May 10 at 16:43

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.