Advertisement
Guest User

Untitled

a guest
Jun 28th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.64 KB | None | 0 0
  1. #!/usr/bin/python
  2.  
  3. #Open the file
  4. log = open('assaultcube.log')
  5.  
  6. #Set logs dict
  7. logs = { 'asylum' : '', 'warrior' : '', 'coop' : '', 'clash' : '', 'castle' : '' }
  8.  
  9. #Loop through each line
  10. for line in log.readlines():
  11.     #Check for nl and length
  12.     if line == '\n' or len(line.split('[')[1].split(']')[0]) > 7:
  13.         continue
  14.  
  15.     #Add to logs
  16.     logs[line.split('[')[1].split(']')[0]] += line
  17.  
  18. #Seperate out the files
  19. [open('/var/www/aclogs/' + server + '/' + server + '_' + logs[server][0:7].strip().replace(' ', '_') + '.log', 'w').write(logs[server]) for server in logs]
  20.  
  21. #Fix the assaultcube log file
  22. open('assaultcube.log', 'w').write('')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement