File tree 1 file changed +33
-0
lines changed
1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change
1
+ #!/opt/homebrew/bin/python3
2
+
3
+ import sys
4
+
5
+ # how to run this script:
6
+ # chmod +x clean_up.py && ./clean_up.py input.txt output.txt
7
+
8
+ if __name__ == "__main__" :
9
+ args = sys .argv
10
+ print ("Arguments are: {}" .format (args ))
11
+ if len (args ) < 3 :
12
+ print ("Please provide STAGE argument: gamma or prod!" )
13
+ raise Exception ("Please provide required arguments!" )
14
+
15
+ in_file = args [1 ]
16
+ out_file = args [2 ]
17
+
18
+ with open (in_file ) as file :
19
+ i = 0
20
+ lines = ""
21
+ for line in file :
22
+ if i % 2 :
23
+ lines = lines + line .rstrip () + " "
24
+ if i % 5 == 0 :
25
+ lines = lines + "\n "
26
+ i = i + 1
27
+ print ("lines are: {}" .format (lines ))
28
+
29
+ with open (out_file , "w" ) as out :
30
+ out .write ("%s" % lines )
31
+
32
+ print ("Finished cleaning up transcripts to this file: {}" .format (out_file ))
33
+
You can’t perform that action at this time.
0 commit comments