how do you represent an or ('|') in a perldo command? Right now, it
gives a syntax error; it looks like it short circuits the line rather
than represents an or in a regular expression..
Ed
- Your Vim version is compiled with +perl, of course? (Check the output
of ":version".)
- Which Perl command are you trying to execute for each line in the
range (or, by default, in the file)?
- What is the text of the error you get?
Since :perldo is listed at ":help :bar", it would seem that the
":perldo" command sees the bar as part of its argument.
Best regards,
Tony.
--
Peter's Law of Substitution:
Look after the molehills, and the mountains will look after
themselves.
In external commands, | separates two processes to be run in such way
that the sysout of the first (cat) is fed on sysin to the second (grep).
(In this case you could, more simply, do "grep blah <
/var/log/messages"). Since Vim uses bash (or cmd.exe or whatever) to run
the external command, the bar must be escaped on the bash command-line.
In the :perl and :perldo commands it might be different.
>
> On Tue, Nov 18, 2008 at 11:37 PM, Tony Mechelynck
> <antoine.m...@gmail.com <mailto:antoine.m...@gmail.com>> wrote:
>
>
> On 19/11/08 03:13, Edward Peschko wrote:
> > also -
> >
> > how do you represent an or ('|') in a perldo command? Right now, it
> > gives a syntax error; it looks like it short circuits the line rather
> > than represents an or in a regular expression..
> >
> > Ed
>
> - Your Vim version is compiled with +perl, of course? (Check the output
> of ":version".)
> - Which Perl command are you trying to execute for each line in the
> range (or, by default, in the file)?
> - What is the text of the error you get?
>
> Since :perldo is listed at ":help :bar", it would seem that the
> ":perldo" command sees the bar as part of its argument.
>
>
> Best regards,
> Tony.
--
"My life is a soap opera, but who has the rights?"
-- MadameX
You can even go one character shorter by leaving out the redirection.
grep blah /var/log/messages
~Matt