I think that’s what you’re looking for:
workflow {
channel.of(
"A1,0000,c0",
"A1,0000,c1",
"A1,0000,c2",
"A1,0000,c3",
"A1,0000,c4",
"B1,0000,c0",
"B1,0000,c1",
"B1,0000,c2",
"B1,0000,c3",
"B1,0000,c4",
"A1,0001,c0",
"A1,0001,c1",
"A1,0001,c2",
"B1,0001,c3",
"B1,0001,c4",
)
.collectFile(seed: "WELL,TILE,CYCLE", name: 'tile-well-list.csv', newLine: true,
sort: { it -> it.tokenize(',')[2] }
)
}
tree work
Output file:
WELL,TILE,CYCLE
A1,0000,c0
B1,0000,c0
A1,0001,c0
A1,0000,c1
B1,0000,c1
A1,0001,c1
A1,0000,c2
B1,0000,c2
A1,0001,c2
A1,0000,c3
B1,0000,c3
B1,0001,c3
A1,0000,c4
B1,0000,c4
B1,0001,c4
