How to set cursor in editor to pattern given on command line?

steve steve at lonetwin.net
Mon Nov 2 07:32:25 UTC 2009


On 11/02/2009 12:58 AM, Frantisek Hanzlik wrote:
> Hello all,
> [...snip...]
> Just something as "+/{pattern}" option in vim editor does.
>
> I want offer to (unexperienced) users edit (in shell script) some
> configuration files, and this should be done with some simple editor
> (no Emacs or vi). I think e.g. joe or mcedit is simple enough for
> these users, but joe nor mcedit cann't? probably? solve this demand
> (joe's command line option for jump to given line number (+nnn) isn't
> too much useable for this).

This is a fairly common requirement when distributing applications which may 
need config file changes, to inexperienced uses. My approach is generally to 
provide a command rather have the users open an editor, eg:

$ sed -i -e "s/foo = LOOK_FOR/foo = REPLACEMENT/" foo.conf

of course you could precede that with something like ...

"""
...edit the file in the editor of your choice and change foo = ...
OR
execute the commands below ...
"""

hth,
regards,
- steve
-- 
random non tech spiel: http://lonetwin.blogspot.com/
tech randomness: http://lonehacks.blogspot.com/
what i'm stumbling into: http://lonetwin.stumbleupon.com/




More information about the fedora-list mailing list