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
11-27-2010, 01:42 AM
Kaushal Shriyan
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
11-27-2010, 01:43 AM
Kaushal Shriyan
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
11-27-2010, 02:03 AM
Suvayu Ali
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
11-27-2010, 02:06 AM
Kaushal Shriyan
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
11-27-2010, 02:38 AM
Ricardo Ramírez
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
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
11-27-2010, 03:17 AM
Suvayu Ali
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
11-27-2010, 07:11 AM
"Tim H."
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
11-27-2010, 09:52 AM
Javier Barroso
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