import re


def read_DOS_file(filename):
    """
    read and format DOS obtained from SplitDos.sh.
    remove the first line and last line which is the operator used by SplitDos.sh
    """

    f = open(filename, 'r')
    data = [ ]
    for line in f:
        line = line.strip("\n ")
        m = re.findall("[\.\+\-E0-9]+", line)
        if m:
            m = [float(num) for num in m]
            data.append(tuple(m))
    f.close()
    data.pop(0); data.pop(-1)
    return tuple(data)