truncate fastq.gz file without error in Snakemake
Snakemake is using bash strict mode to ensure best practice error reporting in shell commands. Unfortunately some tools violate bash strict mode.

More details of the error, here. Alternatively, you can use if you don't want disable the strict mode.

zcat file.fastq.gz  | awk '(NR&lt;=400000)' &gt; subset.fastq