File:  [Repository] / cdli / splitatf.py
Revision 1.1: download - view: text, annotated - select for diffs - revision graph
Thu Nov 3 01:47:58 2005 UTC (18 years, 6 months ago) by dwinter
Branches: MAIN
CVS tags: HEAD
*** empty log message ***

"""split atf file, get an atf file"""

import sys

def splitatf(filename):
    """split it"""
    try:
        fh=open(filename,"r")
    except:
        print """Can't open file: %s (%s %s)"""%(filename,sys.exc_info()[0],sys.exc_info()[0])
    
    nf=None
    for line in fh.readlines():
        print line
        if (len(line.lstrip())>0) and (line.lstrip()[0]=="&"): #newfile
            if nf:
                nf.close() #close last file
        
            
            filename=line[1:].split("=")[0].rstrip()+".atf"
            nf=file(filename,"w")
            
        nf.write(line)
    
    nf.close()
    fh.close()
    

splitatf(sys.argv[1])

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>