FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Ubuntu > Ubuntu User

 
 
LinkBack Thread Tools
 
Old 11-27-2010, 01:42 AM
Kaushal Shriyan
 
Default edit multiple files under multiple directories/folders

Hi,
In my home folder I have 6 tomcat directories under /home/kaushal/tomcat0......6


Under each of these tomcats there are sub folder conf and inside these conf there is a file by the name server.xml so for example I have tomcat0,tomcat1,tomcat2,tomcat3,tomcat4,tomcat5 so i need to edit server.xml and set port numbers for tomcat0 to 8080 tomcat1 to 8081 and similarly for others,the other way is to go to individual directory and do it



Please suggest/guide
Thanks and Regards
Kaushal
--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 11-27-2010, 01:42 AM
Kaushal Shriyan
 
Default edit multiple files under multiple directories/folders

Hi,
In my home folder I have 6 tomcat directories under /home/kaushal/tomcat0......6


Under each of these tomcats there are sub folder conf and inside these conf there is a file by the name server.xml so for example I have tomcat0,tomcat1,tomcat2,tomcat3,tomcat4,tomcat5 so i need to edit server.xml and set port numbers for tomcat0 to 8080 tomcat1 to 8081 and similarly for others,the other way is to go to individual directory and do it



Please suggest/guide
Thanks and Regards
Kaushal
--
users mailing list
users@lists.fedoraproject.org
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
 
Old 11-27-2010, 01:43 AM
Kaushal Shriyan
 
Default edit multiple files under multiple directories/folders

Hi,
In my home folder I have 6 tomcat directories under /home/kaushal/tomcat0......6


Under each of these tomcats there are sub folder conf and inside these conf there is a file by the name server.xml so for example I have tomcat0,tomcat1,tomcat2,tomcat3,tomcat4,tomcat5 so i need to edit server.xml and set port numbers for tomcat0 to 8080 tomcat1 to 8081 and similarly for others,the other way is to go to individual directory and do it



Please suggest/guide
Thanks and Regards
Kaushal
 
Old 11-27-2010, 02:03 AM
Suvayu Ali
 
Default edit multiple files under multiple directories/folders

On 27/11/10 03:42 AM, Kaushal Shriyan wrote:
> Hi,
>
> In my home folder I have 6 tomcat directories under
> /home/kaushal/tomcat0......6
>
> Under each of these tomcats there are sub folder conf and inside these conf
> there is a file by the name server.xml so for example I have
> tomcat0,tomcat1,tomcat2,tomcat3,tomcat4,tomcat5 so i need to edit server.xml
> and set port numbers for tomcat0 to 8080 tomcat1 to 8081 and similarly for
> others,the other way is to go to individual directory and do it
>
> Please suggest/guide
>

$ emacs ~/tomcat{0..6}/conf/server.xml &

The above should bring up emacs with a buffer showing the last file in
the list, and another buffer listing all the other buffers visiting the
other server.xml files. Of course if you prefer some other editor you
can use that instead of emacs.

> Thanks and Regards
>

Happy hacking.

> Kaushal
>
>


--
Suvayu

Open source is the future. It sets us free.
--
users mailing list
users@lists.fedoraproject.org
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
 
Old 11-27-2010, 02:06 AM
Kaushal Shriyan
 
Default edit multiple files under multiple directories/folders

On Sat, Nov 27, 2010 at 8:33 AM, Suvayu Ali <fatkasuvayu+linux@gmail.com> wrote:


On 27/11/10 03:42 AM, Kaushal Shriyan wrote:

> Hi,

>

> In my home folder I have 6 tomcat directories under

> /home/kaushal/tomcat0......6

>

> Under each of these tomcats there are sub folder conf and inside these conf

> there is a file by the name server.xml so for example I have

> tomcat0,tomcat1,tomcat2,tomcat3,tomcat4,tomcat5 so i need to edit server.xml

> and set port numbers for tomcat0 to 8080 tomcat1 to 8081 and similarly for

> others,the other way is to go to individual directory and do it

>

> Please suggest/guide

>



$ emacs ~/tomcat{0..6}/conf/server.xml &



The above should bring up emacs with a buffer showing the last file in

the list, and another buffer listing all the other buffers visiting the

other server.xml files. Of course if you prefer some other editor you

can use that instead of emacs.



> Thanks and Regards

>



Happy hacking.
*Hi Again,
I am comfortable using vim editor. Please suggest
Thanks
Kaushal
--
users mailing list
users@lists.fedoraproject.org
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
 
Old 11-27-2010, 02:38 AM
Ricardo Ramírez
 
Default edit multiple files under multiple directories/folders

Hi,
maybe something like this:

PORT=8079;for i in $(find . -iname "server.xml"|sort); do let PORT=$PORT+1; echo $PORT > $i; done

or this:

PORT=8079;for i in $(find . -iname "server.xml"|sort); do let PORT=$PORT+1; sed -i -e "s/actualPort/$PORT/g" $i; done


best regards.

2010/11/26 Kaushal Shriyan <kaushalshriyan@gmail.com>

Hi,
In my home folder I have 6 tomcat directories under /home/kaushal/tomcat0......6


Under each of these tomcats there are sub folder conf and inside these conf there is a file by the name server.xml so for example I have tomcat0,tomcat1,tomcat2,tomcat3,tomcat4,tomcat5 so i need to edit server.xml and set port numbers for tomcat0 to 8080 tomcat1 to 8081 and similarly for others,the other way is to go to individual directory and do it




Please suggest/guide
Thanks and Regards
Kaushal
 
Old 11-27-2010, 03:17 AM
Suvayu Ali
 
Default edit multiple files under multiple directories/folders

On 27/11/10 04:06 AM, Kaushal Shriyan wrote:
>> $ emacs ~/tomcat{0..6}/conf/server.xml&
>> >
>> > The above should bring up emacs with a buffer showing the last file in
>> > the list, and another buffer listing all the other buffers visiting the
>> > other server.xml files. Of course if you prefer some other editor you
>> > can use that instead of emacs.
>> >
>
> I am comfortable using vim editor. Please suggest

I just did! Doesn't replacing emacs with vim and removing the & at the
end work? I don't know anything about navigating buffers within vim, but
that should be possible.


--
Suvayu

Open source is the future. It sets us free.
--
users mailing list
users@lists.fedoraproject.org
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
 
Old 11-27-2010, 07:11 AM
"Tim H."
 
Default edit multiple files under multiple directories/folders

> Hi,
>
> In my home folder I have 6 tomcat directories under
> /home/kaushal/tomcat0......6
>
> Under each of these tomcats there are sub folder conf and inside these
> conf there is a file by the name server.xml so for example I have
> tomcat0,tomcat1,tomcat2,tomcat3,tomcat4,tomcat5 so i need to edit
> server.xml and set port numbers for tomcat0 to 8080 tomcat1 to 8081 and
> similarly for others,the other way is to go to individual directory and
> do it
>
> Please suggest/guide
>
> Thanks and Regards
>
> Kaushal
>

I little server administration script would do. Something with the sed
command:

echo tomcat*/server.xm | sed s/80/8081/g

If you wish to give a different port for each, use a for loop. This is
not correct but the right idea:

#!/bin/bash
port=8080
for var in `find ./ -name server.xml`
do
echo $var | sed s/80/$port/g
port=$((port + 1))
done

This is assuming the script already has port 80 as the default. Just
find what it is exactly you need to search for to alter it with 'sed'.


Tim H.
blog.pwnspeak.com

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 11-27-2010, 09:52 AM
Javier Barroso
 
Default edit multiple files under multiple directories/folders

On Sat, Nov 27, 2010 at 3:43 AM, Kaushal Shriyan
<kaushalshriyan@gmail.com> wrote:
> Hi,
> In my home folder I have 6 tomcat directories under
> /home/kaushal/tomcat0......6
> Under each of these tomcats there are sub folder conf and inside these conf
> there is a file by the name server.xml so for example I have
> tomcat0,tomcat1,tomcat2,tomcat3,tomcat4,tomcat5 so i need to edit server.xml
> and set port numbers for tomcat0 to 8080 tomcat1 to 8081 and similarly for
> others,the other way is to go to individual directory and do it
>
> Please suggest/guide

for i in {0..6} # or $(seq 0 6)
do
sed -i "s/8080/808$i/" tomcat$i/.../server.xml
done

Regards,


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: AANLkTin6b5PsLQqeEUnWCOOBX2ts2kyMgKtY6-4mE1D5@mail.gmail.com">http://lists.debian.org/AANLkTin6b5PsLQqeEUnWCOOBX2ts2kyMgKtY6-4mE1D5@mail.gmail.com
 

Thread Tools




All times are GMT. The time now is 03:12 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2007 - 2008, www.linux-archive.org