I was provided a ragged right UNIX text file with the CR/LF position of most lines appears to be set at 100. I was provided a column layout document that takes the file out to position 150. Is there a way to change the CR/LF position to 150? If I import into SQL Server using the format provided, since the linefeed is at 100, SQL Server grabs the first 50 characters of the next line.
How to change the ragged right CR/LF position in .txt file (ie using UltraEdit) before importing in SQL Server?
233 views Asked by Boog Muns At
1
I can offer 2 solutions.
Using column mode
There are now 150 characters left of caret position.
Click in menu Column on menu item Delete Columns, enter 1 and execute the command.
Now all lines in file have 150 characters. You might want to go to end of file using Ctrl+End and delete the 150 spaces in last line if this line does not contain anything else.
You can enable Show Line Endings in menu View to check the lines visually.
This solution is often the easiest method for small files.
Using Perl regular expression replaces
Now all lines have 150 or more characters.
The second Perl regular expression using a marking group for the first 150 characters of each line back referenced with \1 to keep them removes all other inserted spaces from each line from column 151 to end of line.
This solution is better for very large files and of course works also with other editors supporting Perl regular expression replaces.