Step 1
Open any text editor (gedit,pico,vi,nano) then enter the following python script and save the file with .py extension.
#!/usr/bin/python
#Author : Jijo K Jose
input_file = raw_input("\nEnter input file name : ")
output_file = "file_new.txt"
h1 = open(input_file,"r")
print "\n—————————-"
print "Input File Content"
print "—————————-\n"
for i in h1:
print i,
h1.close()
h1 = open(input_file,"r")
h2 = open(output_file,"w")
k=0
for i in h1:
i2 = i.split(',')
for j in i2:
n = len(j)
if j[n-1] =="\n":
h2.write(j)
else:
h2.write(j)
h2.write("\n")
h1.close()
h2.close()
print "\n—————————"
print "Output File Content – file_new.txt"
print"—————————-\n"
h1 = open(output_file,"r")
for i in h1:
print i,
print "\n—————————\n"
#END