bdix-servers / scripts /remove-empty-lines.py
Tanvir1337's picture
init scripts
d6be317 verified
raw
history blame contribute delete
522 Bytes
import sys
def remove_empty_lines(input_file, output_file):
with open(input_file, 'r') as file:
lines = file.readlines()
with open(output_file, 'w') as file:
for line in lines:
if line.strip():
file.write(line)
if __name__ == "__main__":
if len(sys.argv) != 2:
print("Usage: python remove_empty_lines.py <input_file>")
sys.exit(1)
input_file = sys.argv[1]
output_file = 'no_empty_lines.txt'
remove_empty_lines(input_file, output_file)