07-07-2008
inserting a new line in a file
I'm sure you guys have answered this elsewhere but I can't seem to find where so here goes.
#!/bin/bash
n=120
a=$(sed '120q;d' energy.xvg)
while [ a != exit ];do
a=$(sed $n'q;d' energy.xvg)
echo "$a \n" > newfile
n=$(($n+100))
done
exit 0
that script should read the file energy.xvg, start at line 120, and copy every 100th line to newfile. The problem is that it only outputs to one line in the file and so every line overwrites the one before it. I want it to write to a new line each time.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Dear All,
I have a file called football where i have a list of 11 players each on different lines.
I wish to add a name of another player on the first line.
I have created a file called footballscript in vi writing the following sed command to achieve this ...
cat football | sed -e '1 i\... (4 Replies)
Discussion started by: Mary_xxx
4 Replies
2. Shell Programming and Scripting
Hi,
I have two files--
file1-
file2:-
i have to compare two files and where the uid is same i have to take the password and insert it above the telephone number.
the output should be like this--
uid : 1418 common so insert the password thbs above the line telephonenumber. (2 Replies)
Discussion started by: namishtiwari
2 Replies
3. Shell Programming and Scripting
I need a perl script to find and replace a specific pattern in a file to a new line.
BAsically I have a single line data in a file with 10 mb to 200 MB. I want to put a new line based on a specific pattern to open the file in Excel / Access.
Following is the sample data in a file
... (1 Reply)
Discussion started by: portalfaq
1 Replies
4. Shell Programming and Scripting
I have posted it previously but somehow could not delete the previous post.I felt i could not explain the problem statement well.
Here t goes.I have a file say File1. Now i need a specific pattern from the lines to be added to the other line.
File:
red blue green ABC.txt@ABC END
black... (1 Reply)
Discussion started by: ngupta
1 Replies
5. Shell Programming and Scripting
this is utterly embarassing :(
after posting here i revisited my files and found that when i used "vi" instead of a gui based editor, i suddenly found that the indentations were in fact wrong :(
sorry about this :( (0 Replies)
Discussion started by: mocca
0 Replies
6. Shell Programming and Scripting
Hi,
I have this line:
ip=111.222.133.144,mac=00:16:3E:2A:08:3C,vifname=veth360','ip=10.2.3.4,vifname=veth360a'
^
|
-------
I want to insert this IP 144.133.222.111 between "144"... (4 Replies)
Discussion started by: iga3725
4 Replies
7. Shell Programming and Scripting
Friends ,
I have a large file and i need to insert a line after every line.I am actually unaware how to do it.Any help appreciated.
My File
control station *ATM* , qread $OSS.Jul13A.FI01 interval 1 intcount 1
control station *ATM* , qread $OSS.Jul13A.FI02 interval 1 intcount... (4 Replies)
Discussion started by: appu2176
4 Replies
8. Shell Programming and Scripting
hello ..
I am new to perl scripting, I have a text file, and would like to insert 3 new lines into the same file at different line numbers using perl scripting. Any Help regarding this will be very useful.
say the file is sample.txt, contents are
aaaaa
bbbb
ccccc
dddd
eeeee
ffffffff... (4 Replies)
Discussion started by: hemalathak10
4 Replies
9. Shell Programming and Scripting
Hi,
consider a file called mobile.txt as follows:
For type lovers, add a new line at the end of it by copying its previous line and add a +1 to the field1, field2
Additionally, there are only 3 plans available to lovers type, so it should not work for lovers type already having 3 lines under... (11 Replies)
Discussion started by: Gautham
11 Replies
10. UNIX for Beginners Questions & Answers
Hi there,
I am having this problem:
a) I am uploading a txt file from windows (notepad) with some Gaussian 09 command lines;
b) Gaussian needs in certain command files, that those files have a blank line at the end of the file!
c) I open the command file with vi and no blank line at the of... (2 Replies)
Discussion started by: luismga
2 Replies
LEARN ABOUT DEBIAN
g_enemat
g_enemat(1) GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c g_enemat(1)
NAME
g_enemat - extracts an energy matrix from an energy file
VERSION 4.5.4-dev-20110404-bc5695c
SYNOPSIS
g_enemat -f ener.edr -groups groups.dat -eref eref.dat -emat emat.xpm -etot energy.xvg -[no]h -[no]version -nice int -b time -e time -dt
time -[no]w -xvg enum -[no]sum -skip int -[no]mean -nlevels int -max real -min real -[no]coul -[no]coulr -[no]coul14 -[no]lj -[no]lj
-[no]lj14 -[no]bhamsr -[no]bhamlr -[no]free -temp real
DESCRIPTION
g_enemat extracts an energy matrix from the energy file ( -f). With -groups a file must be supplied with on each line a group of atoms
to be used. For these groups matrix of interaction energies will be extracted from the energy file by looking for energy groups with names
corresponding to pairs of groups of atoms, e.g. if your -groups file contains:
2
Protein
SOL
then energy groups with names like 'Coul-SR:Protein-SOL' and 'LJ:Protein-SOL' are expected in the energy file (although g_enemat is most
useful if many groups are analyzed simultaneously). Matrices for different energy types are written out separately, as controlled by the
-[no]coul, -[no]coulr, -[no]coul14, -[no]lj, -[no]lj14, -[no]bham and -[no]free options. Finally, the total interaction energy
energy per group can be calculated ( -etot).
An approximation of the free energy can be calculated using: E(free) = E0 + kT log( exp((E-E0)/kT) ), where '' stands for time-average. A
file with reference free energies can be supplied to calculate the free energy difference with some reference state. Group names (e.g.
residue names) in the reference file should correspond to the group names as used in the -groups file, but a appended number (e.g. residue
number) in the -groups will be ignored in the comparison.
FILES
-f ener.edr Input, Opt.
Energy file
-groups groups.dat Input
Generic data file
-eref eref.dat Input, Opt.
Generic data file
-emat emat.xpm Output
X PixMap compatible matrix file
-etot energy.xvg Output
xvgr/xmgr file
OTHER OPTIONS
-[no]hno
Print help info and quit
-[no]versionno
Print version info and quit
-nice int 19
Set the nicelevel
-b time 0
First frame (ps) to read from trajectory
-e time 0
Last frame (ps) to read from trajectory
-dt time 0
Only use frame when t MOD dt = first time (ps)
-[no]wno
View output .xvg, .xpm, .eps and .pdb files
-xvg enum xmgrace
xvg plot formatting: xmgrace, xmgr or none
-[no]sumno
Sum the energy terms selected rather than display them all
-skip int 0
Skip number of frames between data points
-[no]meanyes
with -groups extracts matrix of mean energies instead of matrix for each timestep
-nlevels int 20
number of levels for matrix colors
-max real 1e+20
max value for energies
-min real -1e+20
min value for energies
-[no]coulyes
extract Coulomb SR energies
-[no]coulrno
extract Coulomb LR energies
-[no]coul14no
extract Coulomb 1-4 energies
-[no]ljyes
extract Lennard-Jones SR energies
-[no]ljno
extract Lennard-Jones LR energies
-[no]lj14no
extract Lennard-Jones 1-4 energies
-[no]bhamsrno
extract Buckingham SR energies
-[no]bhamlrno
extract Buckingham LR energies
-[no]freeyes
calculate free energy
-temp real 300
reference temperature for free energy calculation
SEE ALSO
gromacs(7)
More information about GROMACS is available at <http://www.gromacs.org/>.
Mon 4 Apr 2011 g_enemat(1)