knowledge-database (beta)

Current group: comp.editors

VIM - add words

VIM - add words  
R.Noory
 Re: VIM - add words  
Sven Guckes
 Re: VIM - add words  
Lukas Mai
From:R.Noory
Subject:VIM - add words
Date:19 Jan 2005 16:11:34 -0800
Hello,

I have a list of words
abc
ghj
npqr

Is it possible to transform this words in a command with a regular
expression to give this:

grep 'abc' out.txt > abc.txt
grep 'ghj' out.txt > ghj.txt
grep 'npqr' out.txt > npqr.txt

If yes, please help me.

Thanks
From:Sven Guckes
Subject:Re: VIM - add words
Date:20 Jan 2005 00:35:12 GMT
* R.Noory [2005-01-20]:
> I have a list of words
> abc
> ghj
> npqr
>
> Is it possible to transform this words in a
> command with a regular expression to give this:
>
> grep 'abc' out.txt > abc.txt
> grep 'ghj' out.txt > ghj.txt
> grep 'npqr' out.txt > npqr.txt

for word in abc ghj npqr; do
grep $word > $word.txt
done

no vim required.

Sven
From:Lukas Mai
Subject:Re: VIM - add words
Date:20 Jan 2005 03:33:03 GMT
R.Noory schrob:
> Hello,

> I have a list of words
> abc
> ghj
> npqr

> Is it possible to transform this words in a command with a regular
> expression to give this:

> grep 'abc' out.txt > abc.txt
> grep 'ghj' out.txt > ghj.txt
> grep 'npqr' out.txt > npqr.txt

:%s/.*/grep '&' out.txt > &.txt/
(untested)

Lukas
--
/*>++++++++++++[<+++++++>-]<.>+++++[<++++>-]<.---.+++++++++++++.-------------.[
-]>++++++++[<++++>-]*/#include/*+++++++++[<++++++++>-]<+.++++++++++.*/
/*[-]>++++++++[<++++>-]<*/int main(void){return puts("There is no .")*0;}/*>+++
++++++++++[<++++++>-]<.+.[-]>++++++++[<++++>-]<.++++++++++++++.[-]++++++++++.*/
   

Copyright © 2006 knowledge-database   -   All rights reserved