[gmx-users] how to write in a script?
João Henriques
joao.henriques.32353 at gmail.com
Thu Aug 7 17:48:46 CEST 2014
Well, my example was just how to insert a line into a file. I thought this
was where you were having trouble.
If you really want to insert it into a specific line, there are two main
ways of doing it:
1) Either you know the exact line number and you use an awk command, for
example.
2) Or you search for the unique string delimiters and insert it in between.
Any of these can be accomplished with any imaginable scripting/programing
language. You can even use a combination of "head" and "tail" and print
your new line in between, in case you have a specific line number:
`head -n xx file > newfile; echo "blablabla" >> newfile; tail -n yy file >>
newfile`
To be honest this is more of a "stack overflow" type of issue than a
gromacs list problem. Either way, if the last user's solution doesn't work
for you, I can try to give you specific code to solve your problem.
Best regards,
/J
On Thu, Aug 7, 2014 at 1:52 PM, Albert <mailmd2011 at gmail.com> wrote:
> Hi Joao:
>
> thanks a lot for kind reply.
>
> I don't get the point how to use it properly. I am trying to insert
>
> #ifdef POSRES_UNK
>
>
> betwee the following two lines:
>
>
>
> ; position restraints for System of
> [ position_restraints ]
>
>
>
> It should be looks like the following after script:
>
>
>
> ; position restraints for System of
> #ifdef POSRES_UNK
> [ position_restraints ]
>
>
> can you elaberate more how to use it? I tried to run it with command:
>
> cat tmp.itp > ligand.itp << EOF
> ? #ifdef POSRES_UNK
> ? EOF
>
> it seems doesn't work...
>
> THX
>
> Albert
>
>
>
>
> On 08/07/2014 02:37 PM, João Henriques wrote:
>
>> Something like this. Edit it according to your needs.
>>
>> """
>> cat > file << EOF
>> #ifdef POSRES_UNK
>> EOF
>> """
>>
>
> --
> Gromacs Users mailing list
>
> * Please search the archive at http://www.gromacs.org/
> Support/Mailing_Lists/GMX-Users_List before posting!
>
> * Can't post? Read http://www.gromacs.org/Support/Mailing_Lists
>
> * For (un)subscribe requests visit
> https://maillist.sys.kth.se/mailman/listinfo/gromacs.org_gmx-users or
> send a mail to gmx-users-request at gromacs.org.
>
More information about the gromacs.org_gmx-users
mailing list