#!/usr/bin/python
def main(args):
    name, args = args[0], args[1:]
    if len(args) == 2:
        start, end, file_ = args[0], args[0], args[1]
    elif len(args) == 3:
        start, end, file_ = args[0:3]
    else:
        exit()
    try:
        start = int(start)
        end = int(end)
        length = end-start+1
    except TypeError:
        exit()
    import subprocess
    cmd = "head -n {0} {2} | tail -n {1}".format(end, length, file_)
    subprocess.call(cmd, shell="bash")

if __name__=="__main__":
    import sys
    main(sys.argv)
