I have a file similar to the below with multiple entries of a similar nature.
I want to change /riskops/RISKOPS to /risktss/RISKTSS in one VM command. I can do it easily in two. Just basically the same string with one being lower case and the other being upper case as seen below.
>I have a file similar to the below with multiple entries of a similar nature.
>I want to change /riskops/RISKOPS to /risktss/RISKTSS in one VM command.
>I can do it easily in two. Just basically the same string with one being
>lower case and the other being upper case as seen below.
>From:
>/u01/app/oracle/diag/rdbms/riskops/RISKOPS/cdump
>to:
>/u01/app/oracle/diag/rdbms/risktss/RISKTSS/cdump
It is not at all clear what you're really talking about.
-- The motto of the GOP "base": You can't be a billionaire, but at least you
can vote like one.
> I have a file similar to the below with multiple entries of a
> similar nature.
> I want to change /riskops/RISKOPS to /risktss/RISKTSS in one VM
> command. I can do it easily in two. Just basically the same string
> with one being lower case and the other being upper case as seen
> below.
JAW <jwill...@aglresources.com> writes:
> If you're asking how to change one word to another and keep the case of > the letters the same, e.g. so that some command "X" when run like this:
> X/foo/bar/g
> would change all occurrences of foo to bar and all occurrences of FOO to > BAR, there is no command like that.
> Ed.
> Ed clarified what I am seeking to do .
> Same text with different case I am attemping to do in one command.
This may not be helpful to you,
but emacs does case preserving change quite nicely.
Janis Papanagnou <janis_papanag...@hotmail.com> wrote:
> Am 20.09.2012 13:20, schrieb Ed Morton:
> [...]
> > You'll need a vim plugin then. A quick google search shows you can use
> [ links to plugins snipped ]
> > Apparently after installing them the "S" (for the second one or "%SC"
> > for the first) command will let you do:
> > :S/foo/bar/g
> > to replace 'Foo foo FOO' with 'Bar bar BAR'.
> Curious; how would that plugin (or the respective emacs function) handle
> :S/foo/bart/g
> if applied on the quoted data ('Foo foo FOO')? - A literal small 't' in
> all three parts ('Bart bart BARt'), or some magic like 'Bart bart BART'?
From what I read on the web pages, it looks like the last one. I also saw an
example where they somehow do a translation on a mixed case word, but I can't
find that now and I can't be bothered to look for it again. At least one of
the macros I posted links to can also convert foo_bar to fooBar, etc. Google
(and maybe comp.editors) is your friend...
> Janis Papanagnou <janis_papanag...@hotmail.com> writes:
> <snip>
>> Curious; how would that plugin (or the respective emacs function) handle
>> :S/foo/bart/g
>> if applied on the quoted data ('Foo foo FOO')? - A literal small 't' in
>> all three parts ('Bart bart BARt'), or some magic like 'Bart bart
>> BART'?
> Emacs does the magic one. The term suggests you think this option is a
> little mysterious, but it seem like the natural option to me.
Not mysterious, but you can't tell whether that's the "Right Thing" to
assume be the only answer; I think it depends on the context. Example:
You have in a text some misspelled, or rather syntactically malformed,
words: "My set of dvc is as large as your set of DVC." and you, maybe,
want it to become: "My set of dvds is as large as your set of DVDs.",
then the plural 's' should not be capitalised. Maybe this ad hoc made
up case is rarer than the ones covered by the "magic" behaviour, but
possible anyway, and thus it depends. But maybe emacs' "magic" is so
advanced that it handles even that case. ;-)
> On 20.09.2012 19:11, Ben Bacarisse wrote:
> > Janis Papanagnou <janis_papanag...@hotmail.com> writes:
> > <snip>
> >> Curious; how would that plugin (or the respective emacs function) handle
> >> :S/foo/bart/g
> >> if applied on the quoted data ('Foo foo FOO')? - A literal small 't' in
> >> all three parts ('Bart bart BARt'), or some magic like 'Bart bart
> >> BART'?
> > Emacs does the magic one. The term suggests you think this option is a
> > little mysterious, but it seem like the natural option to me.
> Not mysterious, but you can't tell whether that's the "Right Thing" to
> assume be the only answer; I think it depends on the context. Example:
> You have in a text some misspelled, or rather syntactically malformed,
> words: "My set of dvc is as large as your set of DVC." and you, maybe,
> want it to become: "My set of dvds is as large as your set of DVDs.",
> then the plural 's' should not be capitalised. Maybe this ad hoc made
> up case is rarer than the ones covered by the "magic" behaviour, but
> possible anyway, and thus it depends. But maybe emacs' "magic" is so
> advanced that it handles even that case. ;-)
> Janis
These things are heuristics. By definition, a heuristic is intended to handle the common case, but it shouldn't be expected to be perfect.
-- Barry Margolin, bar...@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
Ed Morton <mortons...@gmail.com> wrote:
> Janis Papanagnou <janis_papanag...@hotmail.com> wrote:
>> Am 20.09.2012 13:20, schrieb Ed Morton:
>> [...]
>> > You'll need a vim plugin then. A quick google search shows you can use
>> [ links to plugins snipped ]
>> > Apparently after installing them the "S" (for the second one or "%SC"
>> > for the first) command will let you do:
>> > :S/foo/bar/g
>> > to replace 'Foo foo FOO' with 'Bar bar BAR'.
>> Curious; how would that plugin (or the respective emacs function) handle
>> :S/foo/bart/g
>> if applied on the quoted data ('Foo foo FOO')? - A literal small 't' in
>> all three parts ('Bart bart BARt'), or some magic like 'Bart bart BART'?
> From what I read on the web pages, it looks like the last one. I also
> saw an example where they somehow do a translation on a mixed case
> word, but I can't find that now
> At least one of the macros the macros I posted links to can also
> convert foo_bar to fooBar, etc. Google (and maybe comp.editors) is
> your friend...
> In article <k3fkn2$pd...@news.m-online.net>,
> Janis Papanagnou <janis_papanag...@hotmail.com> wrote:
>> On 20.09.2012 19:11, Ben Bacarisse wrote:
>>> Janis Papanagnou <janis_papanag...@hotmail.com> writes:
>>> <snip>
>>>> Curious; how would that plugin (or the respective emacs function) handle
>>>> :S/foo/bart/g
>>>> if applied on the quoted data ('Foo foo FOO')? - A literal small 't' in
>>>> all three parts ('Bart bart BARt'), or some magic like 'Bart bart
>>>> BART'?
>>> Emacs does the magic one. The term suggests you think this option is a
>>> little mysterious, but it seem like the natural option to me.
>> Not mysterious, but you can't tell whether that's the "Right Thing" to
>> assume be the only answer; I think it depends on the context. Example:
>> You have in a text some misspelled, or rather syntactically malformed,
>> words: "My set of dvc is as large as your set of DVC." and you, maybe,
>> want it to become: "My set of dvds is as large as your set of DVDs.",
>> then the plural 's' should not be capitalised. Maybe this ad hoc made
>> up case is rarer than the ones covered by the "magic" behaviour, but
>> possible anyway, and thus it depends. But maybe emacs' "magic" is so
>> advanced that it handles even that case. ;-)
>> Janis
> These things are heuristics. By definition, a heuristic is intended to
> handle the common case, but it shouldn't be expected to be perfect.
To be useful that feature (as every function) should be well defined.
My question was, how does it (emacs, vim plugin) behave in cases where
two sensible applications/interpretations/functions are possible. Even
any approach based on a heuristic evaluation what might be considered
more useful in most cases should be well defined for an editor operator.
My question was not about a "perfect solution", rather about the chosen
actual implementation.