Hi all
I need to put a command line parser together to parse numeric fields and ranges passed to a script. I'm looking for a bash function that is as elegant and simple as possible.
So the input would be of the following form -
1,2,8-12
This would return -
1,2,8,9,10,11,12
Input can contain multiple positive or negative ranges of the form -
9-12,19-15
in any order with comma delimited single integers interspersed anywhere on the line.
I've come up with some code but frankly its ugly and I suspect that this is a problem that's been solved before.
Does anyone have a good solution?
Brad