I'm trying to take a file that looks like this:
And get it to look like this
I'm using a python script, so far this is what I have:
#!/usr/bin/python import sys if len(sys.argv) < 2: print "usage: finalmyscript.py infile.txt" sys.exit(1) fname = sys.argv handle = open(fname, "r") list = handle.readlines() for line in list: parts = line.rstrip('\n') linearr = parts.split() combine = ''.join(linearr) print combine handle.close()
The script removes the '\n' at the end of each line, but it still won't join the lines all on a single line. Can anyone help with where I'm going wrong?