> touch {dark\ red,green,light\ blue}{cheese,fish\ fingers,fruit}
> ls -1 *(cheese|fish)*([1,5])
dark redcheese
dark redfish fingers
greencheese
greenfish fingers
light bluecheese
> for i in *(cheese|fish)*([1,5]) ...
Since that's shell globbing, it can cope with any spaces, newlines etc.
Wow, that is quite impressive, I might have to look into this more. The advantage of using head is I only have to learn it once, to get the first n of lines or files, but it might be worth learning. Thanks.