63167Re: How to check if I have lines with different length in a database extract
- Nov 2, 2005Thanks Tim..
That was very useful.
That's what exactly I was looking for.
Direct: +44 - 01484 440 365
Tim Chase <vim@...>
Subject: Re: How to check if I have lines with different length in a database
> Each type of file has some fixed length of a line. Before we can passWell, a couple ideas stand out to me. Depending on your file size (in
> on this file for further processing I would like to check that all
> lines are of equal length. Is there a simple way /pattern by which I
> can identify lines with differing length.
lines), it could be as simple as
and then scrolling down, watching the right margin to see if any of the
"$" characters dance out of position.
If, however, you've got a large file (or more lines than you reasonably
care to scroll through), you can use something like
which will return a list of each of the lines that *don't* have 40
characters in them, along with their line numbers. Your desire would be
to get back the "error"
Pattern found on every line
However, if there are lines that don't have 40 characters, it will
return them along with their line number. If you want to make changes
to each line, just type the line number followed by "G" and you'll jump
to the line in question.
If you simply want to filter these errant lines out of your file by
deleting them completely, you can simply change the "#" to a "d" in the
above command, such as
and it will delete any of the problematic lines.
If order doesn't matter, you can take a pre-processing pass and move
them all to the bottom of the file with
where you can edit them all or deal with them accordingly.
Hope this gives you something to work with.
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
- << Previous post in topic Next post in topic >>