Adding (as in arithmetic) to numbers in columns in file, and writing new file with new numbers
Hi again. Sorry for all the questions — I've tried to do all this myself but I'm just not good enough yet, and the help I've received so far from bartus11 has been absolutely invaluable. Hopefully this will be the last bit of file manipulation I need to do.
I have a file which is formatted as follows:
The coordinates there correspond to water molecules. In column 2 (beginning with 1 and ending with 15) I need to add 5294 to all the numbers and write a new file — or modify the original, but I assume this isn't possible — to give 5295 through 5309. In the third column, which has sets of three of the same five numbers (257 — 261) I need to do something similar, and subtract 126 from all of them (giving 131 — 135).
I should mention that the file itself has many thousands more of these lines, so ideally I need something which is acting on all the numbers in the respective columns. I figured awk but what I've tried isn't capable of handling the numbers as numbers, which is where I'm falling down, so I don't know if something like Python would work, but I've not had much luck there either and don't have much experience with the language.
The reason I need to do this is so that the software I'm using will be able to correctly read the coordinates I'm trying to combine.
Once again any help would be greatly appreciated. Many thanks.
Last edited by crunchgargoyle; 04-05-2014 at 03:24 PM..
Reason: Minor clarity edit
Hello everyone !
Ive searched everywhere and still havnt found enough information to help me overcome (what seems like) a small problem
I have created a temporary file in which i store numbers which a seperated by a space, eg)
5 10 46
23 866 392
i wish to take the numbers for each line... (2 Replies)
Howdy experts,
We have some ranges of number which belongs to particual group as below.
GroupNo StartRange EndRange
Group0125 935300 935399
Group2006 935400 935476
937430 937459
Group0324 935477 935549
... (6 Replies)
I am begining to learn bourne shell and as a practice I have written a script which when given the purchase price and percentage of discount calculates the savings.
I somehow cannot figure out why my script fails to do arthimatic calculation on real numbers.
Could anyone look at the script... (5 Replies)
Hello All,
I am having problem to find what is the smallest number from 90% of highest numbers from all numbers in file. I am having file with thousands of lines and hundreds of columns.
I am familiar mainly with bash but I am open to whatever suggestion witch will lead to the solutions.
If I... (11 Replies)
Hi
I figured how to add my list of numbers. However how do I count so that after a certain number it lists the line.
Example:
12 test1
46 test2
195 test3
174 test4
634 test5
185 test6
94 test7
So basically add the numbers and when the addition reaches 300 or less
print the... (8 Replies)
Dear all,
I have one file (see below) with more then 100 columns and 2500 rows, and need only column which has GType in label with Alphabets, please help me to remove these columns with numbers.
input file is
n.201.GType n-201.Theta n-201.R n_1.GType n_1.Theta n_1.R... (6 Replies)
Hi,
I would like to add a new column containing the row numbers to a text file. How do I go about doing that? Thanks!
Example input:
A X
B Y
C D
Output:
A X 1
B Y 2
C D 3 (5 Replies)
Hello,
I am having a problem when i execute following script on RHEL 6.4. Same script works fine on another machine where I have same version of RHEL and KSH.
Below is the rpm and RHEL version.
ossvm12(0)> rpm -qa | grep ksh
ksh-20100621-19.el6.x86_64
ossvm12(0)> cat... (7 Replies)
Hi Folks,
I have a file with 2 columns TAB delimited and I want to add '1' to the first column and subtract '-1' from the second column.
What I have tried so far is;
awk -F"\t" '{ $1-=1;$2+=1}1' OFS='\t' file
File
0623 0623
0624 0624
0643 0643
1059 1037
1037 1037
1038 1038... (2 Replies)
Discussion started by: pshields1984
2 Replies
LEARN ABOUT DEBIAN
balls
BALLS(1) General Commands Manual BALLS(1)NAME
balls - preprocessor for space-filling models in Raster3D molecular graphics package
SYNOPSIS
balls [-h]
Balls reads a file describing atom colours and/or a PDB coordinate file and produces a file containing Raster3D descriptor records for each
atom in the input file. The file produced by balls may be fed directly to render or it may be combined with descriptor files produced by
other Raster3D utilities.
EXAMPLES
To describe a simple space-filling model coloured by residue type:
cat mycolours.pdb protein.pdb | balls | render > mypicture.png
To include a pre-selected view matrix with the same model:
cp view1.matrix setup.matrix
cat mycolours.pdb protein.pdb | balls | render > mypicture.png
To prepend header records describing a pre-selected scale and view:
cat mycolours.pdb protein.pdb | balls -h > balls.r3d
cat header.r3d balls.r3d | render > mypicture.png
OPTIONS -h
Suppress header records in output. By default balls will produce an output file which starts with header records containing a default set
of scaling and processing options. The -h flag will suppress these header records so that the output file contains only sphere descrip-
tors. This option is useful for producing files which describe only part of a scene, and which are to be later combined with descriptor
files produced by other programs.
DESCRIPTION
The input to balls consists of a single text file containing colour information and atomic coordinates in PDB data bank format. Coordi-
nates are output as Raster3D descriptor records with colours and sphere radii assigned according to the COLO records described below. By
default atoms are assigned CPK colours. By default the output file contains a set of header records as required by the render program.
The header is constructed to include a TMAT matrix corresponding to the transformation matrix contained in file setup.matrix (if it
exists), or to the Eulerian angles contained in file setup.angles (if it exists).
Colours are assigned to atoms using a matching process, using COLOUR records prepended to the input PDB file. Raster3D uses a pseudo-PDB
record type with with COLO in the first 4 columns:
Columns
1 - 4 COLO
7 - 30 Mask (described below)
31 - 38 Red component
39 - 46 Green component
47 - 54 Blue component
55 - 60 van der Waals radius in Angstroms
61 - 80 Comments
Note that the Red, Green, and Blue components are in the same positions as the X, Y, and Z components of an ATOM or HETA record, and the
van der Waals radius goes in place of the Occupancy. The Red, Green, and Blue components must all be in the range 0 to 1.
The Mask field is used in the matching process as follows. First the program reads in and stores all the ATOM, HETA, and COLOUR records in
input order. Then it goes through each stored ATOM/HETA record in turn, and searches for a COLOUR record that matches the ATOM/HETA record
in all of columns 7 through 30. The first such COLOUR record to be found determines the colour and radius of the atom.
In order that one COLOUR record can provide colour and radius specifications for more than one atom (e.g., based on residue or atom type,
or any other criterion for which labels can be given somewhere in columns 7 through 30), the "#" symbol is used as a wildcard. I.e. a # in
a COLOUR record matches any character in the corresponding column in an ATOM or HETA record. All other characters must match literally to
count as a match. Note that the very last COLO record in the input should have # symbols in all of columns 7 through 30 in order to pro-
vide a colour for any atom whose ATOM/HETA record fails to match any previous COLOUR record. This idea of matching masks for colour speci-
fications is due to Colin Broughton.
Several files of COLOUR records, including one based on Bob Fletterick's "Shapely Models" and another mimicking CPK model parts, are pro-
vided as samples.
ENVIRONMENT
The files setup.matrix and setup.angles, if they exist, affect the
header records produced by balls.
SOURCE
anonymous ftp site:
ftp.bmsc.washington.edu
web URL:
http://www.bmsc.washington.edu/raster3d/raster3d.html
contact:
Ethan A Merritt
University of Washington, Seattle WA 98195
merritt@u.washington.edu
SEE ALSO
render(l), rods(l), ribbon(l)
AUTHORS
Originally written by David J Bacon and Wayne F Anderson.
Extensions and revisions by Ethan A Merritt.
Raster3D 8 May 1999 BALLS(1)