On 08/04/2011 08:59 AM, [email protected] wrote:
For such an example, I'd use a combination of :put with the
expression register, which takes a list:
:put=[var, 'line2', '.', 'that was a line with 1 period']
Just to be clear, I should have said ":put with the expression
register, which *can take* a list"...it's not limited to a list,
but for doing multiple lines, it's a very nice way to do it.
b) Has ex an option such as -s (meaning string) so that a sh user
could write the previous example this way
sh -s '%s/pattern/replace/g | w' file
(bash or zsh users can already use<<< for this, but I need sh in my
case). What I don't like about ex ...<<EOF, is that it looks weird in
an indented script (the here document must be stuck to the left margin it
seems)
And in fact I even meant ex.
My question is, is it possible to pass commands to ex without stdin?
(-c does not do exactly the same thing)
How are you finding that "-c does not do exactly the same thing"?
I just issued:
bash$ seq 20 > test.txt
bash$ ex -c '10s/$/hello' -c '15>' -c 'wq' test.txt
and it did exactly what I expected, executing both the substitute
on line 10 and the indentation of line 15, followed by writing
and quitting the file.
-tim
--
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