#!/usr/bin/env python 
fname=raw_input('Enter filename: ')
fname='ops_ip_method.log'
try:
    fobj=open(fname,'r')
except IOError,e:
    print '*** file open error:',e
else:
    s=set()
    ss=set()
    for eachLine in fobj:
        if eachLine not in s:
            s.add(eachLine)
            arr=eachLine.split(" ")
            if len(arr) >1:
                ss.add(arr[1])
 
         
    fobj.close()
    newFile=open('uniq_ip_method.log','w')
    l=list(s)
    l.sort()
    for item in l:
        item = item.strip()
        if item != '':
            #print item
            newFile.write(item+"\n")
 
    meth=open('uniq_method.log','w')
    ll=list(ss)
    ll.sort()
    for item in ll:
        item = item.strip()
        if item != '':
            #print item
            meth.write(item+"\n")
 
    newFile.close()
    meth.close()