I have a file whose newline delimiter has been accidentally erased. Now I have a whole bunch of 216-character lines, all displaying on a single line. Using the fact that I know the lines will be fixed width, is there a (windows) tool which could insert a line break every 216 characters?

Alternatively, I can get a copy of this file as a CSV. Again, no linebreaks. But this time, I would have to insert a line break every 6 commas.

I have tried importing these to Excel as a CSV, but that requires me to scroll the entire width of the file, removing their line breaks, and inserting my own every 216 characters-- definitely not a solution.

  • You can write a PowerShell script to break it up and then write it out to a text file or CSV file. – Jeff Zeitlin Jan 19 '18 at 20:54

If you have or can get Perl, try out this command in your shell:

perl -C -nlE 'say $1 while (/(\G.{216})/g)' your_input_file
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.