Sorting FASTQ pairs by length

Is there a program here that I can sort by length FASTQ pairs?? For example, if I have a set of reads that are too large to merge with BBmerge, to break it into smaller sections. So if I have read pairs 2x150, theoretically most reads smaller than 150 will likely merge. So if I want to split up my read set with all reads at say 145bp as a pair, and all reads 146-150bp as a pair??

I think “SeqKit sort” can do what you’re asking for in the title, but it seems rather unefficient to create a sorted copy of the input, then cut that into two additional datasets.

Haven’t tried this, but in theory you should be able to generate the two outputs in one step with “Cutadapt”. Make sure you disable adapter trimming, configure your preferred read length window, and under additional outputs to generate, select “Too short reads” or “Too long reads” according to your needs.

Curious myself to hear whether this works.