 | | 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;}/*>+++ ++++++++++[<++++++>-]<.+.[-]>++++++++[<++++>-]<.++++++++++++++.[-]++++++++++.*/
|
|