Hi!
You culd use an expresion like:
for file in *.mol2; do
NAME=`echo "$file" | cut -d'.' -f1`
echo $NAME
....
done
Greeting,
Hector.
> I have never used expr like you do but you need to decrease the index
> by one
>
> i=`expr index $file .`
> i=`expr $i - 1`
> f1=`expr substr $file 1 $i`
>
> On Fri, 17 Apr 2015 21:15:57 +0530
> Pallavi Mohanty <pallavipmohanty.gmail.com> wrote:
>
>> Thanks Hannes and Jason, yes your suggestions did worked but there is
>> still an issue. My output is in the form of :output1..crd,
>> output1..top, output2..crd ,output2..top and so on.As Hannes had
>> suggested below mentioned is the script :
>> #! /bin/sh
>> for file in output*.pdb; do
>> i=`expr index $file .`
>> f1=`expr substr $file 1 $i`
>> tleap -f - <<_EOF
>> source leaprc.ff99SB
>> x = loadpdb $file
>> saveamberparm x $f1.top $f1.crd
>> quit
>> _EOF
>> done
>> -----------------------------------------
>> where can be the possible fault?
>> Thanking you again!
>>
>> On Fri, Apr 17, 2015 at 7:12 PM, Jason Swails <jason.swails.gmail.com>
>> wrote:
>>
>> > On Fri, Apr 17, 2015 at 9:31 AM, Hannes Loeffler <
>> > Hannes.Loeffler.stfc.ac.uk
>> > > wrote:
>> >
>> > > On Fri, 17 Apr 2015 08:07:17 -0400
>> > > Jason Swails <jason.swails.gmail.com> wrote:
>> > >
>> > > > On Fri, Apr 17, 2015 at 7:17 AM, Hannes Loeffler
>> > > > <Hannes.Loeffler.stfc.ac.uk
>> > > > > wrote:
>> > > >
>> > > > > You are mixing shell scripting with leap scripting. I guess
>> > > > > what you want is this
>> > > > >
>> > > > >
>> > > > > #!/bin/sh
>> > > > >
>> > > > > for file in output*.pdb; do
>> > > > > i=`expr index $file .`
>> > > > > f1=`expr substr $file 1 $i`
>> > > > >
>> > > > > tleap -f - <<_EOF
>> > > > > source leaprc.ff99SB
>> > > > > x = loadpdb $file
>> > > > > saveamberparm x $f1.top $f1.crd
>> > > > > _EOF
>> > > > >
>> > > >
>> > > > ​This doesn't actually work with tleap. stdin must come from a
>> > > > tty, otherwise you get an error like this:
>> > > >
>> > > > ​
>> > > > *** Error: tl_getline(): not interactive, use stdio.
>> > > >
>> > > > ​(I've tried this myself before, wishing it would work).
>> > >
>> > > Yes, because there was no "quit" command. If there is a "quit"
>> > > teLeap will never enter the interactive loop and do the isatty()
>> > > in gl_init() in getline.c.
>> > >
>> > > So script should be
>> > >
>> > > #!/bin/sh
>> > >
>> > > for file in output*.pdb; do
>> > > i=`expr index $file .`
>> > > f1=`expr substr $file 1 $i`
>> > >
>> > > tleap -f - <<_EOF
>> > > source leaprc.ff99SB
>> > > x = loadpdb $file
>> > > saveamberparm x $f1.top $f1.crd
>> > > quit
>> > > _EOF
>> > > done
>> > >
>> >
>> > ​Cool! The "-f -" is essential, it appears (as is the quit, as you
>> > mentioned).
>> >
>> > Thanks!
>> > Jason
>> >
>> > --
>> > Jason M. Swails
>> > BioMaPS,
>> > Rutgers University
>> > Postdoctoral Researcher
>> > _______________________________________________
>> > AMBER mailing list
>> > AMBER.ambermd.org
>> > http://lists.ambermd.org/mailman/listinfo/amber
>> >
>>
>>
>>
>
>
> _______________________________________________
> AMBER mailing list
> AMBER.ambermd.org
> http://lists.ambermd.org/mailman/listinfo/amber
>
--------------------------------------
Dr. Hector A. Baldoni
Area de Quimica General e Inorganica
Universidad Nacional de San Luis
Chacabuco 917 (D5700BWS)
San Luis - Argentina
hbaldoni at unsl dot edu dot ar
Tel.:+54-(0)266-4520300 ext. 6157
--------------------------------------
_______________________________________________
AMBER mailing list
AMBER.ambermd.org
http://lists.ambermd.org/mailman/listinfo/amber
Received on Fri Apr 17 2015 - 09:30:02 PDT