Thursday, March 1, 2012

search replace function

quite often, i want to write a test with a static file (html in this
instance). and i'd like to search and replace with random data. how do
i do this?

%s/thing/!cat /dev/urandom | strings | tr -d "\n" | head -c 15/gc

where 'cat /dev/urandom | strings | tr -d "\n" | head -c 15' is a unix
command (though, if vi has a rand(), i could use that as well)

--
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:

Post a Comment