On 17:57 21 Mar 2003, Wolfgang Gill <wolfgang@xxxxxxxxxxxxxxxxxxxx> wrote:
| Can anyone tell me or point me in the right direction as to where to | get hold of some editor documentation. Either in HTML or PDF format.
| | What I basically would like to do, is to write some *.sh scripts. And | use the editor commands to edit some text files (Command line based). | I want to be able to search for text, and either add text to the file | (in the correct area), or remove the text and/or replace the text in | the file using a script.
Other than the man page I don't know any.
One way I can think of is to use 'diff -e' The output is an ed script. That gives some basic commad usage.
Also remeber that vi is a multi line version of ed, and most of the ed commands work the same in vi, thought they string together differently.
ex, to search for STRING and the change WORD to NEWWORD on all the lines with STRING
g/STRING/s/WORD/NEWWORD/
to delete all linse containing STRING
g/STRING/d
to add SOME_TEXT on a new line after lines with STRING
g/STRING/a\ SOME_TEXT
to append text on a line, you can use the s command s/John/John Smith/
Hope those help you get started.
-Thomas
-- Psyche-list mailing list Psyche-list@xxxxxxxxxx https://listman.redhat.com/mailman/listinfo/psyche-list