Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I have a very large text file.
I tried to edit it using vi editor - unix
when i give " vi abc.txt "
it displays the file but at the last line it says "Line too long"
And i found that it cannot display the whole file. Only the upper part it display.My friend, if you possible please help me.
Thank you.

vi editor has a limitation of the number of characters in a line. If the line exceeds that, it will see the error message as "Line Too Long".
You can use cat command to open the file.
Changing the file contents of such file is a bit difficult.

sed can probably handle the long lines. To test this, pass the file through sed:
sed s/x/x/ filein > fileout
If you can identify your various:
oldpattern1 > newpattern1
oldpattern2 > newpattern2
etcthen this forum can help with a solution.

my recollection is that for non-Linux, the line length restriction applies to multiple utilities.
If a line is too long for vi, it will probably be too long for sed.

No, I have found sed to handle very long lines, which is why I recommended it as a possible solution.
Other commands can also handle the longer lines such as wc and diff, to name a couple.

Jim,
As I tried to note, the Linux flavored utilities have no or very long line length restrictions.my original post almost said:
'if your OS is "windows xp" what vi are you using?'r u sure your *nix utilities (ed, ex, vi ,sed, diff, etc.) are of the same flavor as chamil?

No, different platform. I could not say for sure, which is why I said that sed can PROBABLY handle the long lines.
You stated that, for non-Linux, if a line is too long for vi, it will probably be too long for sed.
But I do not find that correct for at least one non-Linux platform. On HP-UX, awk can handle lines up to about 2400 characters, and vi up to about 3000 characters I think, while sed can handle lines much longer than that.

vi is limited at 4096 (sol.8) char per line. use command fold -w 4095 file > file.new to wrap the lines.

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |