Sponsored Content
Top Forums Shell Programming and Scripting How to insert something to a file from another file with shell? Post 303007250 by 510426762 on Tuesday 14th of November 2017 12:33:48 PM
Old 11-14-2017
How to insert something to a file from another file with shell?

complex.gro
Code:
Great Red Owns Many ACres of Sand 
 6340
    6SER      N    1   2.724  13.826   0.957
    6SER     H1    2   2.685  13.863   1.041
    6SER     H2    3   2.783  13.748   0.979
   .
   .
   .
  405TYR      C 6338   4.079  11.113   0.908
  405TYR    OC1 6339   4.166  11.065   0.896
  405TYR    OC2 6340   4.045  11.204   0.829
   8.10576   5.73277   5.32581


lig.gro
Code:
MOL_GMX.gro created by acpype (Rev: 10101) on Tue Nov 14 21:43:44 2017
 37
    1  MOL   C1    1   5.094  10.087   2.868
    1  MOL   C2    2   4.998  10.172   2.807
    1  MOL   C3    3   4.940  10.136   2.690
   .
   .
   .
    1  MOL  H15   35   5.432  10.090   3.227
    1  MOL  H16   36   5.389  10.124   2.993
    1  MOL  H17   37   5.482   9.982   2.948
   15.26200    11.53200    18.72600

I want insert the red part of lig.gro in the complex.gro before the last line
and
change the 2nd line number in complex.gro(6340+37)

the result is like next
complex.gro
Code:
Great Red Owns Many ACres of Sand 
 6377
    6SER      N    1   2.724  13.826   0.957
    6SER     H1    2   2.685  13.863   1.041
    6SER     H2    3   2.783  13.748   0.979
   .
   .
   .
  405TYR      C 6338   4.079  11.113   0.908
  405TYR    OC1 6339   4.166  11.065   0.896
  405TYR    OC2 6340   4.045  11.204   0.829
    1  MOL   C1    1   5.094  10.087   2.868
    1  MOL   C2    2   4.998  10.172   2.807
    1  MOL   C3    3   4.940  10.136   2.690
   .
   .
   .
    1  MOL  H15   35   5.432  10.090   3.227
    1  MOL  H16   36   5.389  10.124   2.993
    1  MOL  H17   37   5.482   9.982   2.948
   8.10576   5.73277   5.32581

How can I reach the result by using shell script

Last edited by 510426762; 11-14-2017 at 01:58 PM.. Reason: Removed external links
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

script to run shell command and insert results to existing xml file

Hi. Thanks for any help with this. I'm not new to programming but I am new to shell programming. I need a script that will 1. execute 'df -k' and return the volume names with specific text 2. surround each line of the above results in opening and closing xml tags 3. insert the results of step... (5 Replies)
Discussion started by: littlejon
5 Replies

2. Shell Programming and Scripting

Insert a function in a jsp file using Shell scripting

Greetings to all.I am new to the forum as well as to UNIX as well.I have a jsp file which has the following selectedStartMonth = request.getParameter( "startMonth" ); selectedStartDay = request.getParameter( "startDay" ); selectedStartYear = request.getParameter( "startYear" );... (3 Replies)
Discussion started by: 20033716
3 Replies

3. Shell Programming and Scripting

Korn shell program to parse CSV text file and insert values into Oracle database

Enclosed is comma separated text file. I need to write a korn shell program that will parse the text file and insert the values into Oracle database. I need to write the korn shell program on Red Hat Enterprise Linux server. Oracle database is 10g. (15 Replies)
Discussion started by: shellguy
15 Replies

4. UNIX for Dummies Questions & Answers

Shell script find word from one file and insert in another file

Hi, I am new to shell scripting. I need a bash shell scripts which search and grep a parameter value from input.txt file and insert it in between two semicolon of second line of output.txt file. For example The shell script search an IP address as parameter value from input.txt ... (2 Replies)
Discussion started by: sunilkumarsinha
2 Replies

5. Shell Programming and Scripting

How to insert a sequence number column inside a pipe delimited csv file using shell scripting?

Hi All, I need a shell script which could insert a sequence number column inside a dat file(pipe delimited). I have the dat file similar to the one as shown below.. |A|B|C||D|E |F|G|H||I|J |K|L|M||N|O |P|Q|R||S|T As shown above, the column 4 is currently blank and i need to insert sequence... (5 Replies)
Discussion started by: nithins007
5 Replies

6. Shell Programming and Scripting

Insert shell command into first line of output file

How can I insert the command executed on the shell into the first line of my output file? For example if I execute; zcat *.gz |grep “User5501” > users.out How can I make my users.out look like; zcat *.gz |grep “User5501” > users.out User5501 PA User5501 UA User5501 ZA... (3 Replies)
Discussion started by: lewk
3 Replies

7. UNIX for Dummies Questions & Answers

Insert text into a file using shell script

Hi, I need to insert "Hello World" text into a file called hai.txt using shell scripting. Kindly help me. For eg: If I open the file hai.txt by giving linux command cat hai.txt, the content of the file should have the text Hello World in it. Thanks (5 Replies)
Discussion started by: karthick nath
5 Replies

8. Shell Programming and Scripting

Insert content of a file to another file at a line number which is given by third file

Hi friends, here is my problem. I have three files like this.. cat file1.txt ======= unix is best unix is best linux is best unix is best linux is best linux is best unix is best unix is best cat file2.txt ======== Windows performs better Mac OS performs better Windows... (4 Replies)
Discussion started by: Jagadeesh Kumar
4 Replies

9. UNIX for Beginners Questions & Answers

How to insert data into black column( Secound Column ) in excel (.XLSX) file using shell script?

Source Code of the original script is down below please run the script and try to solve this problem this is my data and I want it column wise 2019-03-20 13:00:00:000 2019-03-20 15:00:00:000 1 Operating System LAB 0 1 1 1 1 1 1 1 1 1 0 1 (5 Replies)
Discussion started by: Shubham1182
5 Replies
genbox(1)					 GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c					 genbox(1)

NAME
genbox - solvates a system VERSION 4.5.4-dev-20110404-bc5695c SYNOPSIS
genbox -cp protein.gro -cs spc216.gro -ci insert.gro -o out.gro -p topol.top -[no]h -[no]version -nice int -box vector -nmol int -try int -seed int -vdwd real -shell real -maxsol int -[no]vel DESCRIPTION
genbox can do one of 3 things: 1) Generate a box of solvent. Specify -cs and -box. Or specify -cs and -cp with a structure file with a box, but without atoms. 2) Solvate a solute configuration, e.g. a protein, in a bath of solvent molecules. Specify -cp (solute) and -cs (solvent). The box spec- ified in the solute coordinate file ( -cp) is used, unless -box is set. If you want the solute to be centered in the box, the program editconf has sophisticated options to change the box dimensions and center the solute. Solvent molecules are removed from the box where the distance between any atom of the solute molecule(s) and any atom of the solvent molecule is less than the sum of the van der Waals radii of both atoms. A database ( vdwradii.dat) of van der Waals radii is read by the program, and atoms not in the database are assigned a default distance -vdwd. Note that this option will also influence the distances between solvent molecules if they contain atoms that are not in the database. 3) Insert a number ( -nmol) of extra molecules ( -ci) at random positions. The program iterates until nmol molecules have been inserted in the box. To test whether an insertion is successful the same van der Waals criterium is used as for removal of solvent molecules. When no appropriately-sized holes (holes that can hold an extra molecule) are available, the program tries for -nmol * -try times before giv- ing up. Increase -try if you have several small holes to fill. If you need to do more than one of the above operations, it can be best to call genbox separately for each operation, so that you are sure of the order in which the operations occur. The default solvent is Simple Point Charge water (SPC), with coordinates from $GMXLIB/spc216.gro. These coordinates can also be used for other 3-site water models, since a short equibilibration will remove the small differences between the models. Other solvents are also supported, as well as mixed solvents. The only restriction to solvent types is that a solvent molecule consists of exactly one residue. The residue information in the coordinate files is used, and should therefore be more or less consistent. In practice this means that two sub- sequent solvent molecules in the solvent coordinate file should have different residue number. The box of solute is built by stacking the coordinates read from the coordinate file. This means that these coordinates should be equlibrated in periodic boundary conditions to ensure a good alignment of molecules on the stacking interfaces. The -maxsol option simply adds only the first -maxsol solvent molecules and leaves out the rest would have fit into the box. The program can optionally rotate the solute molecule to align the longest molecule axis along a box edge. This way the amount of solvent molecules necessary is reduced. It should be kept in mind that this only works for short simulations, as e.g. an alpha-helical peptide in solution can rotate over 90 degrees, within 500 ps. In general it is therefore better to make a more or less cubic box. Setting -shell larger than zero will place a layer of water of the specified thickness (nm) around the solute. Hint: it is a good idea to put the protein in the center of a box first (using editconf). Finally, genbox will optionally remove lines from your topology file in which a number of solvent molecules is already added, and adds a line with the total number of solvent molecules in your coordinate file. FILES
-cp protein.gro Input, Opt. Structure file: gro g96 pdb tpr etc. -cs spc216.gro Input, Opt., Lib. Structure file: gro g96 pdb tpr etc. -ci insert.gro Input, Opt. Structure file: gro g96 pdb tpr etc. -o out.gro Output Structure file: gro g96 pdb etc. -p topol.top In/Out, Opt. Topology file OTHER OPTIONS
-[no]hno Print help info and quit -[no]versionno Print version info and quit -nice int 19 Set the nicelevel -box vector 0 0 0 box size -nmol int 0 no of extra molecules to insert -try int 10 try inserting -nmol times -try times -seed int 1997 random generator seed -vdwd real 0.105 default vdwaals distance -shell real 0 thickness of optional water layer around solute -maxsol int 0 maximum number of solvent molecules to add if they fit in the box. If zero (default) this is ignored -[no]velno keep velocities from input solute and solvent KNOWN PROBLEMS
- Molecules must be whole in the initial configurations. SEE ALSO
gromacs(7) More information about GROMACS is available at <http://www.gromacs.org/>. Mon 4 Apr 2011 genbox(1)
All times are GMT -4. The time now is 02:30 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy