Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

vi - Line too long 1

Status
Not open for further replies.

prv3116

MIS
Mar 16, 2001
80
US
How can a file be edited that has a line in it that is too long for vi? It is actually a file that our Oracle DBA's use. The word count is 114 / 778. Attempting to vi the file only shows a part of the first line and then the error "Line too long". They have a work around, by ftp'ing the file to their PC and editing it with Notepad, then ftp'ing it back. Any other suggestions?
 
I don't know the flavour of Unix you use but you could look to see if you have the commands dos2unix and unix2dos available.

If so then use dos2unix to convert the input file into Unix format, edit it and then use unix2dos to put it back into pc format.

Hope this helps.
 
This is some kind of Oracle/SQL file on an AIX machine. I have seen this in the past with other files where a line was too long and couldn't be edited with vi. I can cat the file and see all the characters, just can't vi it.
 
Sorry but was my first reply of any use?

What are you trying to edit within this file? Do you really need to view it to carry out the required changes?


 
They do need to view it to make the changes. This is a file they use for Oracle to create tables. It is merely a long line of text with

CREATE TABLE " ... " (... being the table information).

It is not a dos file. I have found that if they edit it with the Text Editor on the CDE toolbar, they can see the whole file, line by line, and make the changes. It is strange, but after they do that once, they can then use vi without any problem and it doesn't seem to adversely affect the file. I have ask the DBA's to try that and see if the file is still usable, I don't see why it wouldn't be. That of course is better then ftp'ing the file to their PC and using Notepad! But I am still curious to know how to get around this with vi, should you not have access to Text Editor.

I remember seeing something similar to this a few years ago. We had allowed the /etc/group file to get too large in a certain group. We couldn't vi it and even had problem editing it with smit. We ended up having to use the split command and break it into smaller pieces and divide up that particular group into 2 groups, then combined the two files into one /etc/group again. I tried that with this file but I had to split it into about 100 files to get them into editable sizes. Which is not a working solution.

So I have a fix, by using the Text Editor, but would still like a vi solution.
 
This is actually a problem with vi's buffer size, it keeps for line length. When that limit exceeds vi puts that message "line too long...".

A simple solution to this would be to break a single long line into may be two or three lines. This should not create any problem with your SQL parser as long as it encounters a ; as end of statement.

Hope this helps you :)
 
Hi,
What happens if you append a line feed to the end of the file? You can enter: echo \011 >> myfile to see if this would make a difference.
 
The echo statement just put a 011 at the end of the file. I can cat or tail the file and see the 011, but still get the "line too long". I will mention to the DBA's to break their file into smaller pieces.
Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top