Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

"Incomplete Last Line" error using vi

  • 27-01-2009 01:33PM
    #1
    Registered Users, Registered Users 2 Posts: 53 ✭✭


    Hey - I need someones help ASAP -I'm editing a file in Unix and after exiting the last file and trying to reopen it using vi as normal, I get an incomplete last line error... how do you solve this without losing any of the code???

    Your responses will be greatly appreciated :confused:

    By the way..the file is an XML file


Comments

  • Registered Users, Registered Users 2, Paid Member Posts: 2,032 ✭✭✭lynchie


    Unix files usually end with a newline character (\n). Your file is probably missing it. While it may not cause an issue vi is just warning you. To remove it simply goto last line and add a new line and save.


  • Registered Users, Registered Users 2 Posts: 53 ✭✭bunnyfox7


    I tried this and overwrote the file and now the whole file is now only displaying in Hex and I cant convert it back... my backup is doing the same. The error is now gone and when I type in "vi myfile.xml" it just gives out hex right away... what has happened?


  • Registered Users, Registered Users 2 Posts: 2,082 ✭✭✭Tobias Greeshman


    hmm thats strange. Can you try running ":display normal" in vi, see what difference that makes.

    The hex display in vi normally only occurs if vi thinks its a binary file.

    For curiosity type "file myfile.xml" at the shell prompt, see if it mentions it being a binary file.


Advertisement