process SPLIT { tag "$meta.id" label 'small_mem_mono_cpus' container "lbmc/alpine:3.17" input: tuple val(meta), path(fastq) output: tuple val(meta), path("*.fastq.gz"), emit: fastq path "versions.yml" , emit: versions script: def args = task.ext.args ?: '' """ zcat ${fastq} | split -l 4000000 - ${fastq.simpleName}_ ls -l ${fastq.simpleName}_* | \\ awk '{system("if [\$((wc -l "\$9")) -ne 4000000]; then exit 1; fi")}' ls -l ${fastq.simpleName}_* | \\ awk '{system("gzip -c "\$9" > "\$9".fastq.gz && rm "\$9)}' cat <<-END_VERSIONS > versions.yml "${task.process}": split: v1.35.0 END_VERSIONS """ }