[gmx-users] Re: Re:Shell scripts
shounakb
baners4 at rpi.edu
Thu Jul 5 20:56:53 CEST 2012
Hi,
you might want to try the following code in bash
#!/bin/bash
i=1
while [ $i -le 1322 ]
do
g_energy -f traj_$i.edr -o $i.xvg << EOF
i=`expr $i + 1`
done
Hope this helps!
Shounak
lloyd riggs wrote
>
> Dear All,
>
> So I am using some scripts to parse through 100s of files using bash and
> awk. In any case, I run into a problem as follows; I have Ubuntu at home
> on my PC and I have a laptop at work with Ubuntu, same versions libraries,
> everything. When I run the scripts at home they work fine, when I run
> them at the Ubuntu at work I get errors ranging from "Bad for loop
> variable" all the way to an infanite done at end of line no matter how
> much you type done.
>
> Does any one know why, or have some other scripts...
>
> Examples of just parsin energy files:
>
> #!/bin/bash
> i=1
> for ((i=1;i<=1322;i+=1)); do
> g_energy -f traj_${i}.edr -o ${i}.xvg << EOF
> ${i}
> EOF
> done
>
> or infanite loops
>
> #!/bin/bash
> i=1
> for (( ; ;)); do
> g_energy -f traj_${i}.edr -o ${i}.xvg << EOF
> ${i}
> EOF
> done
>
> or range
>
> #!/bin/bash
>
> for i {1..2121} ; do
> g_energy -f traj_${i}.edr -o ${i}.xvg << EOF
> ${i}
> EOF
> i=$(($i+1))
> done
>
> or while loop
>
> #!/bin/bash
> i=1while [ i -le 2121 ]; do
> g_energy -f traj_${i}.edr -o ${i}.xvg << EOF
> ${i}
> EOF
> done
>
> Ill forgo the awk or cat extensions,
>
> does anyone know why? Or have some other pasing scripts they've jimmied?
>
> Stephan
> --
> gmx-users mailing list gmx-users@
> http://lists.gromacs.org/mailman/listinfo/gmx-users
> * Only plain text messages are allowed!
> * Please search the archive at
> http://www.gromacs.org/Support/Mailing_Lists/Search before posting!
> * Please don't post (un)subscribe requests to the list. Use the
> www interface or send it to gmx-users-request at .
> * Can't post? Read http://www.gromacs.org/Support/Mailing_Lists
>
--
View this message in context: http://gromacs.5086.n6.nabble.com/tricky-business-tp4999110p4999120.html
Sent from the GROMACS Users Forum mailing list archive at Nabble.com.
More information about the gromacs.org_gmx-users
mailing list