python调用shell

import os,math

i=121
while i<225:
    outFile=str(int(math.ceil(float(str(i)+'.0')/4)))
    print outFile
    if i%4==1:
        filename='20151106_mix_'+str(i)+'.data'
    if i%4==2:
        filename='20151106_round_'+str(i)+'.data'
    if i%4==0:
        filename='20151106_'+str(i)+'.data'
    if i%4!=3:
        lines=len(open(filename,'rU').readlines())
        if lines>0:
            #see here
            os.system('cat '+filename+'| grep 6000 >>1109_'+outFile+'_adr.data')
            os.system('cat '+filename+'| grep 8001 >>1109_'+outFile+'_ios.data')
    i=i+1


你可能感兴趣的:(python)