-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathclean_up.py
More file actions
executable file
·33 lines (25 loc) · 866 Bytes
/
clean_up.py
File metadata and controls
executable file
·33 lines (25 loc) · 866 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/opt/homebrew/bin/python3
import sys
# how to run this script:
# chmod +x clean_up.py && ./clean_up.py input.txt output.txt
if __name__ == "__main__":
args = sys.argv
print("Arguments are: {}".format(args))
if len(args) < 3:
print("Please provide STAGE argument: gamma or prod!")
raise Exception("Please provide required arguments!")
in_file = args[1]
out_file = args[2]
with open(in_file) as file:
i = 0
lines = ""
for line in file:
if i % 2:
lines = lines + line.rstrip() + " "
if i % 5 == 0:
lines = lines + "\n"
i = i + 1
print("lines are: {}".format(lines))
with open(out_file, "w") as out:
out.write("%s" % lines)
print("Finished cleaning up transcripts to this file: {}".format(out_file))