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
genconf(1)					 GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c					genconf(1)

NAME
genconf - multiplies a conformation in 'random' orientations VERSION 4.5.4-dev-20110404-bc5695c SYNOPSIS
genconf -f conf.gro -o out.gro -trj traj.xtc -[no]h -[no]version -nice int -nbox vector -dist vector -seed int -[no]rot -[no]shuffle -[no]sort -block int -nmolat int -maxrot vector -[no]renumber DESCRIPTION
genconf multiplies a given coordinate file by simply stacking them on top of each other, like a small child playing with wooden blocks. The program makes a grid of user-defined proportions ( -nbox), and interspaces the grid point with an extra space -dist. When option -rot is used the program does not check for overlap between molecules on grid points. It is recommended to make the box in the input file at least as big as the coordinates + van der Waals radius. If the optional trajectory file is given, conformations are not generated, but read from this file and translated appropriately to build the grid. FILES
-f conf.gro Input Structure file: gro g96 pdb tpr etc. -o out.gro Output Structure file: gro g96 pdb etc. -trj traj.xtc Input, Opt. Trajectory: xtc trr trj gro g96 pdb cpt OTHER OPTIONS
-[no]hno Print help info and quit -[no]versionno Print version info and quit -nice int 0 Set the nicelevel -nbox vector 1 1 1 Number of boxes -dist vector 0 0 0 Distance between boxes -seed int 0 Random generator seed, if 0 generated from the time -[no]rotno Randomly rotate conformations -[no]shuffleno Random shuffling of molecules -[no]sortno Sort molecules on X coord -block int 1 Divide the box in blocks on this number of cpus -nmolat int 3 Number of atoms per molecule, assumed to start from 0. If you set this wrong, it will screw up your system! -maxrot vector 180 180 180 Maximum random rotation -[no]renumberyes Renumber residues KNOWN PROBLEMS
- The program should allow for random displacement of lattice points. SEE ALSO
gromacs(7) More information about GROMACS is available at <http://www.gromacs.org/>. Mon 4 Apr 2011 genconf(1)
All times are GMT -4. The time now is 02:49 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy