Thursday, October 25, 2012

Re: Help using vim script capabilities

On Thursday, October 25, 2012 9:37:33 AM UTC-7, Michael Young wrote:
> Hello!
> I am attempting to use vim in a shell script to read in a file, edit it, and write it out to a new file. When I manually execute the individual vim commands it seems to work properly but when I put the commands in a script file and try to use that, the commands don't seem to work. My shell script generates a recursive file directory listing. I then want to use vim to edit the listing to replace any spaces in each file path with \space. I am including the shell below. HELP!
> Thanks!
> Michael
>
> #!/bin/sh
>
> # Generate a recursive list of full pathnames for all filenames that do not
> # begin with a "."
> find "$1" -type f -and \! -name ".*" > filelist1
>
> # Generate the input script for the vim editor
> # Go through the "find" listing and replace every " " with "\ "
> cat << EOF > vimscript
> :%s/ /\\ /g
> :wq! md5shell
> EOF
>
> # Execute vim with the generated input script
> vim -s vimscript filelist1

Ahhh ... I see where I went wrong. Thank you for your response.

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