def parse_index_specification(spec):
    """Parses an index specification used as arguments for the -f
    and -F options."""
    result = []
    for part in spec.split(","):
        part = part.strip()
        if "-" in part:
            lo, hi = list(map(int, part.split("-", 1)))
            result.extend(range(lo, hi + 1))
        else:
            result.append(int(part))
    return result