in reply to Windows-specific: Limiting output of created files
And alternative would be to use a piped open to monitor the output and then you can kill the process when the limit is reached. (Note:command wrapped for posting):
perl -E" $pid = open IN, '-|', qq[perl -E\"say for 1 .. 100e6\"]; while(<IN>){ $n+=length; print; kill(3,$pid),last if $n>1e5 }" > output.file
|
|---|