Link to home
Start Free TrialLog in
Avatar of tonydemarco
tonydemarcoFlag for United States of America

asked on

Truncate or Pad Each Line In Text File using a DOS Batch File

I have a text file with uneven lines i.e. The first line ends at 185 characters and the next at 201 characters and so on.
I need a way to pad the short lines to the length of the longer lines so I can BULK INSERT into SQL with a format file (.fmt).
The format file uses "\r\n" to find the end of each line so the CrLf has to be in the same place at the end of each line.
I need a batch file to count the columns and insert spaces for the shorter lines.
ASKER CERTIFIED SOLUTION
Avatar of Shift-3
Shift-3
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of tonydemarco

ASKER

Spot On!