Unix questions - vi editing multiple files in nested directories

This is Interesting: Free IT Magazines  
Home > Archive > Unix questions > November 2006 > vi editing multiple files in nested directories





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author vi editing multiple files in nested directories
sshikari@hotmail.com

2006-11-25, 7:21 pm

I would like to edit all files of a certain type in all nested
directories using vi. I am using a version of vi that supports tabs..
so if I am in a certain directroy and type:

cd ruby
vi -p *.rb

it opens all of the .rb files in that directory in seperate tabs.

The problem is that there are .rb files in subdirectories within the
"ruby" directory and I'd like to open all of the .rb files from that
directory down.

I tried:
vi -p */*.rb but that only goes 1 level down.

Searched around for a while and couldn't figure this one out. Any help
would be appreciated.

sshikari@hotmail.com

2006-11-25, 7:21 pm

I played around and got it to work with:

vi -p `find . -name *.rb -print` &


sshikari@hotmail.com wrote:
> I would like to edit all files of a certain type in all nested
> directories using vi. I am using a version of vi that supports tabs..
> so if I am in a certain directroy and type:
>
> cd ruby
> vi -p *.rb
>
> it opens all of the .rb files in that directory in seperate tabs.
>
> The problem is that there are .rb files in subdirectories within the
> "ruby" directory and I'd like to open all of the .rb files from that
> directory down.
>
> I tried:
> vi -p */*.rb but that only goes 1 level down.
>
> Searched around for a while and couldn't figure this one out. Any help
> would be appreciated.


Bill Marcum

2006-11-25, 7:21 pm

On 25 Nov 2006 14:17:41 -0800, sshikari@hotmail.com
<sshikari@hotmail.com> wrote:
> I would like to edit all files of a certain type in all nested
> directories using vi. I am using a version of vi that supports tabs..
> so if I am in a certain directroy and type:
>
> cd ruby
> vi -p *.rb
>
> it opens all of the .rb files in that directory in seperate tabs.
>
> The problem is that there are .rb files in subdirectories within the
> "ruby" directory and I'd like to open all of the .rb files from that
> directory down.
>
> I tried:
> vi -p */*.rb but that only goes 1 level down.
>
> Searched around for a while and couldn't figure this one out. Any help
> would be appreciated.
>

vi -p $(find . -name '*.rb')


--
Psychiatry enables us to correct our faults by confessing our parents'
shortcomings.
-- Laurence J. Peter, "Peter's Principles"
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com