ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/ns_dev/Python/NinoCode/Active_prgs/catlogfiles.py
Revision: 8
Committed: Sat May 5 04:21:19 2012 UTC (13 years, 10 months ago) by ninoborges
Content type: text/x-python
File size: 1214 byte(s)
Log Message:
Initial Import

File Contents

# User Rev Content
1 ninoborges 8 import sys, os
2     from lgflcntr import getoffice
3    
4     def catlogfile(input_file, output_file):
5     appservers = getoffice()
6     output_file = "u:/" + output_file
7     print input_file
8     print "Concatenating names and compiling them into one log file on your U:"
9     clear=open(output_file,'w')
10     clear.close()
11     for x in appservers:
12     server = x + '\n'
13     directory = "//app/log_files/" + input_file
14     place = "//" + x + directory
15     try:
16     f=open(place, 'r')
17     contents = f.readlines()
18     f.close()
19     newfile=open(output_file,'a')
20     newfile.write(server)
21     newfile.writelines(contents)
22     newfile.close()
23     except IOError:
24     print x,"Does not have a log file... skipping"
25    
26     print 'Finished! The new concatenated list has been written to %s'% output_file
27    
28     if __name__ == '__main__':
29     if len(sys.argv) < 2:
30     print "Sorry but this program requires both an input file and an output file.\nThe Syntax is\ncatlogfiles.py inputfile outputfile"
31     else:
32     input_file = sys.argv[1]
33     output_file = sys.argv[2]
34     catlogfile(input_file, output_file)