Monday, December 20, 2010

Re: cygwin startup time

Hi,

rameo wrote:
> Can anyone please tell me how to print a text in vim (windows) using
> awk?
>
> This command works in cygwin:
> awk 'BEGIN { print "test=" }'
>
> but whatever I do I cannot print the word "test=" or whatever other
> word using awk in vim.

cmd.exe does not handle single quotes, so you have to enclose the whole
argument to awk with double quotes. awk does not seem to accept single
quotes either (I'm not sure, because I don't normally use awk), so you
have to put double quotes around test= , too. The problem is now: How
to put quotes inside quotes? One (the?) solution: Put everything except
the quotes inside quotes and escape the quotes that need to be there
for awk. The escape char in cmd.exe is a caret, so you finally get this
command:

:r !awk "BEGIN { print "^""test="^"" }"

Regards,
Jürgen

--
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: