#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2004
    Posts
    2
    Rep Power
    0

    file too long error


    I am new to Unix
    I have been opening files in vi editor by command:
    vi filename

    But for certain files while using this command following error is displayed:
    File too long

    Can anyone help me how to fix this error.
    Thanks in Advance
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2004
    Posts
    60
    Rep Power
    10
    Hi Rohit,

    I'm no expert with vi but have found the following at URL
    http://nscp.upenn.edu/aix4.3html/cmds/aixcmds6/vi.htm

    vi Editor Limitations
    The following list provides the maximum limits of the vi editor. These counts assume single-byte characters.

    {LINE_MAX} characters per line
    256 characters per global command list
    128 characters in the previously inserted and deleted text
    128 characters in a shell escape command
    128 characters in a string-valued option
    30 characters in a tag name
    128 map macros with 2048 characters total
    1,048,560 lines of {LINE_MAX} characters per line silently enforced
    Note: Running the vi editor on a file larger than 64MB may cause the following error message to display:
    0602-103 file too large to place in /tmp
    I don't know if it is possible to get round this particular limitation or even if the note is up to date, but it would make sense that there would be an upper limit on the size of file you can open for editing.

    If you just wanting to read the contents of the file then obviously commands pg, more, less, tail, and head can help.

    If you want to edit the file and the changes are small enough then "sed" might be a better tool. Otherwise, I'd probably split the file somehow and edit the chunks before putting it back together.

    Hmmm.... I'm interested if anyone has any other tips.

    Hope this helps until then.
    Andy
  4. #3
  5. Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    May 2004
    Location
    Superior, CO, USA
    Posts
    2,418
    Rep Power
    1712
    What O/S are you on? That is, Solaris, AIX, HP/UX, Linux, etc? Additionally, how big is the file you're trying to edit. You can do an ls -l on the file to see how big it is.

    This sounds like it is an older O/S but the reality is that you simply may not be able to edit a file as big as you're trying to edit.
  6. #4
  7. Perl Jedi
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2004
    Location
    New Hampshire
    Posts
    116
    Rep Power
    21
    Originally Posted by Rohit Sharma
    I am new to Unix
    I have been opening files in vi editor by command:
    vi filename

    But for certain files while using this command following error is displayed:
    File too long

    Can anyone help me how to fix this error.
    Thanks in Advance

    Basically, the file you are trying to view is unwrapped from the editors point of view. It doesn't contain any valid wrapping character.

    My advice is to look around for a utility or script that will wrap the file at something like 80 bytes or so ( or one that will allow you to specify the wrap length ). Either way, that is what is quite possibly wrong.

    Regards,

    #jlk
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Jul 2004
    Location
    Middle Europa
    Posts
    1,200
    Rep Power
    13
    note the diff:
    a) line too long
    b) file too long

    also vi knows limits
    in case a the line is >1024 chars
    in case b the file is big, very big
    split it, edit and cat

IMN logo majestic logo threadwatch logo seochat tools logo