On 26/07/06, Linda W <[EMAIL PROTECTED]> wrote:
A.J.Mechelynck wrote: > For a single file: > > :e ++ff=dos foobar.txt > :setlocal ff=unix > :w > > For all *.txt files in the current directory: > > :set fileformats=dos > :args *.txt > :set nomore > :argdo setl ff=unix | w > :set more " assuming this is your preferred setting ---- Neat...will have to give it some more thought at some point. I did it the quick & lazy way using perl & the windows cygwin command line:/Prog/Vim> \ # start in VIMRUNTIME dir (Drive C assumed) perl -pi \ # edit files "in-place" -e 's/\r//g' \ # execute "Delete CR" 'script' $( # use "subshell" to create argument list # for the perl "script" to edit find . -type f \ # find all files in VIM dir -exec file {} \; | \ # get "type" of each file grep CRLF | \ # only keep lines containing CRLF files cut -d\: -f1 | cut -c 3-| \ # cut fluff off line & leave FileName (FN) tr "\n" " " # put all FNs on 1 line ) # end subshell leaving FNs as args to perl
If you've just got a load of text files and cygwin, you can also do one of: dos2unix -U *.txt *.vim or find . -type f -iname '*.txt' -o -iname '*.vim' -print0 | xargs -0 dos2unix -U (If you're sure of no funny characters in the filenames, you can ditch the -print0 and -0) Al
