File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How To Edit a File in the Unix?

 
Daniel Gee
Ranch Hand
Posts: 202
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not familiar with the Unix. It so happens that I have to edit a file in the Unix.

The file is .kshre and all I have to do are

1. append a string to my path
2. add four lines to the .kshre file

I use the Putty to logon to my account. I think I should type

vi -r

in the command window. And I do not know what to do next. Could anybody guide me? Thanks.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64185
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Despite being a unix dweeb from way back (and being told on multiple occasions that I "look" like a unix hacker -- whatever that means) I've never come to terms with vi.

You might find pico a more user-friendly alternative.
 
Henry Wong
author
Marshal
Pie
Posts: 20835
75
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I use the Putty to logon to my account. I think I should type

vi -r

in the command window. And I do not know what to do next. Could anybody guide me? Thanks.



Well, I'll give this one a shot...

First, just use... "vi filename.ext" instead of the "-r" option to open the file that you want.

Second, cursor controls may not work -- older version of "vi" did not really support it. Just try to move the cursor. If you get junk, just disconnect and try again.

If cursor control doesn't work, use the letters "h", "j", "k", and "l", to move the cursor around. I believe the leftmost key moves the cursor left, and the rightmost key move the cursor right. Don't remember which of the two remaining keys are for up and down.

Third, when you are over a letter, pressing "x" will delete the letter.

Fourth, when you want to insert something, pressing "i" will put you in insert mode. At this point, just type what you want to insert. Pressing the "esc" key should take you out of insert mode.

Fifth, pressing "a" will put you into append mode. This is the same as insert mode, except you will insert after the current letter. This is good for adding stuff at the end of the line.

And finally, when you are done... make sure you are not in insert or append mode.

Pressing ":" will make a prompt appear on the bottom. Entering a "w" followed by a return will save the file back.

Pressing ":q" followed by a return will exit vi.

Henry
[ May 13, 2006: Message edited by: Henry Wong ]
 
Peter Rooke
Ranch Hand
Posts: 825
Java Linux Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This Graphical vi/vim Cheat Sheet and Tutorial may help.

This vi basic editing should be a good start.
 
Daniel Gee
Ranch Hand
Posts: 202
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for overwhelming responses. I think that I am able to do some editing on my own now.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic