Sponsored Content
Full Discussion: column operation using awk
Top Forums Shell Programming and Scripting column operation using awk Post 302451895 by felipe.vinturin on Wednesday 8th of September 2010 11:58:47 AM
Old 09-08-2010
What do you think about the following:
Code:
# testFile=TestFile.txt
# minValue=`awk 'NR==7{min=$3;max=$3}NR>7{if ($3>max){max=$3};if ($3<min){min=$3}}END {print min}' "${testFile}"`
# awk 'NR>6{print $1 " " $2 " " ($3-"'${minValue}'")}' "${testFile}" | sort -k3
1.45257346E-07 899.10834 0
8.10901852E-08 809.10840 0.003975
4.59328561E-07 764.32300 0.004455
3.36595804E-07 854.32300 0.007133

Regards!
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk - operation over time staps

Hi @ all, I'm trying to accomplish a simple excel-job with awk, without any result... What i have is a file with a time stamp for each line like : 21:02:07 21:04:11 21:06:28 21:08:44 21:10:45 21:12:48 21:14:52 21:16:53 21:18:55 What i would, is to calculate the time elapsed... (7 Replies)
Discussion started by: m4rco-
7 Replies

2. Shell Programming and Scripting

Arithmetic operation with awk

I have output like following in a file usmtnz-dinfsi19 72 71 38 1199 1199 0.8 19:23:58 usmtnz-dinfsi19 72 71 38 1199 1199 0.8 19:24:04 (9 Replies)
Discussion started by: fugitive
9 Replies

3. Shell Programming and Scripting

Column operation : cosne and sine operation

I have a txt file with several columns and i want to peform an operation on two columns and output it to a new txt file . file.txt 900.00000 1 1 1 500.00000 500.00000 100000.000 4 4 1.45257346E-07 899.10834 ... (4 Replies)
Discussion started by: shashi792
4 Replies

4. Shell Programming and Scripting

Enter third column & Perform Operation

I am trying to enter a third column in this file, but the third column should that I call "Math" perform a some math calculations based on the value found in column #2. Here is the input file: Here is the desired output: Output GERk0203078$ Levir Math Cotete_1... (5 Replies)
Discussion started by: Ernst
5 Replies

5. Shell Programming and Scripting

awk math operation on two files

Hi, I need your help. I've got two files and i need to add 2nd line after occurrence of "Group No X" from data2.txt to 3rd line (after occurrence of "Group No X") from data1.txt. There is the same number of "Groups" in both files and the numbers of groups have the same pattern. data1.txt Group... (2 Replies)
Discussion started by: killerbee
2 Replies

6. UNIX for Dummies Questions & Answers

Column minus column operation?

I have a two files, file A and B, which have 5 columns, and each 5 columns are made up of random numbers, that means, numbers are all different. They have same amount of lines (Both 1000 lines) I hope to do a operation 1) 2nd column of file A - 2nd column of file B 2) 5th column of... (4 Replies)
Discussion started by: exsonic
4 Replies

7. Shell Programming and Scripting

How To Perform Mathematical Operation Within If in awk?

Hi All, I am using an awk script as below: awk -F'|' 'BEGIN{OFS="|";} { if ($1==$3 && $3==$7 && $7==$13 && $2==$6 && $6==$11 && $15-$14+1==$11) print $0"|""TRUE"; else print $0"|""FALSE"; }' tempfile.txt In above script, all conditions are being checked except the one which is... (4 Replies)
Discussion started by: angshuman
4 Replies

8. Shell Programming and Scripting

awk --> math-operation in a array

Hi main object is categorize the difference of data-values (TLUFT02B - TLUFT12B). herefor i read out data-files which are named acording to the timeformat yyyymmddhhmm. WR030B 266.48 Grad 0 WR050B 271.46 Grad 0 WR120B 268.11 Grad 0 WV030B 2.51 m/s ... (6 Replies)
Discussion started by: IMPe
6 Replies

9. Shell Programming and Scripting

Using awk to do arithmetic operation

Hi, I've this following text file FileVersion = 1.03 Filetype = meteo_on_curvilinear_grid TIME = 0 hours since 2016-10-03 12:00:00 +00:00 -6.855 -6.828 -6.801 -6.774 -6.747 -6.719 -6.691 -6.663 -6.634 -6.606 -6.577 -6.548 -6.519 -6.489 TIME = 0 hours since... (2 Replies)
Discussion started by: xisan
2 Replies

10. Shell Programming and Scripting

Do replace operation and awk to sum multiple columns if another column has duplicate values

Hi Experts, Please bear with me, i need help I am learning AWk and stuck up in one issue. First point : I want to sum up column value for column 7, 9, 11,13 and column15 if rows in column 5 are duplicates.No action to be taken for rows where value in column 5 is unique. Second point : For... (12 Replies)
Discussion started by: as7951
12 Replies
Bio::Matrix::PhylipDist(3pm)				User Contributed Perl Documentation			      Bio::Matrix::PhylipDist(3pm)

NAME
Bio::Matrix::PhylipDist - A Phylip Distance Matrix object SYNOPSIS
use Bio::Tools::Phylo::Phylip::ProtDist; my $dist = Bio::Tools::Phylo::Phylip::ProtDist->new( -file=>"protdist.out", -program=>"ProtDist"); #or my $dist = Bio::Tools::Phylo::Phylip::ProtDist->new( -fh=>"protdist.out", -program=>"ProtDist"); #get specific entries my $distance_value = $dist->get_entry('ALPHA','BETA'); my @columns = $dist->get_column('ALPHA'); my @rows = $dist->get_row('BETA'); my @diagonal = $dist->get_diagonal(); #print the matrix in phylip numerical format print $dist->print_matrix; DESCRIPTION
Simple object for holding Distance Matrices generated by the following Phylip programs: 1) dnadist 2) protdist 3) restdist It currently handles parsing of the matrix without the data output option. 5 Alpha 0.00000 4.23419 3.63330 6.20865 3.45431 Beta 4.23419 0.00000 3.49289 3.36540 4.29179 Gamma 3.63330 3.49289 0.00000 3.68733 5.84929 Delta 6.20865 3.36540 3.68733 0.00000 4.43345 Epsilon 3.45431 4.29179 5.84929 4.43345 0.00000 FEEDBACK
Mailing Lists User feedback is an integral part of the evolution of this and other Bioperl modules. Send your comments and suggestions preferably to one of the Bioperl mailing lists. Your participation is much appreciated. bioperl-l@bioperl.org - General discussion http://bioperl.org/wiki/Mailing_lists - About the mailing lists Support Please direct usage questions or support issues to the mailing list: bioperl-l@bioperl.org rather than to the module maintainer directly. Many experienced and reponsive experts will be able look at the problem and quickly address it. Please include a thorough description of the problem with code and data examples if at all possible. Reporting Bugs Report bugs to the Bioperl bug tracking system to help us keep track the bugs and their resolution. Bug reports can be submitted via the web: https://redmine.open-bio.org/projects/bioperl/ AUTHOR - Shawn Hoon Email shawnh@fugu-sg.org CONTRIBUTORS
Jason Stajich, jason-at-bioperl-dot-org APPENDIX
The rest of the documentation details each of the object methods. Internal methods are usually preceded with a "_". new Title : new Usage : my $family = Bio::Matrix::PhylipDist->new(-file=>"protdist.out", -program=>"protdist"); Function: Constructor for PhylipDist Object Returns : L<Bio::Matrix::PhylipDist> get_entry Title : get_entry Usage : $matrix->get_entry(); Function: returns a particular entry Returns : a float Arguments: string id1, string id2 get_row Title : get_row Usage : $matrix->get_row('ALPHA'); Function: returns a particular row Returns : an array of float Arguments: string id1 get_column Title : get_column Usage : $matrix->get_column('ALPHA'); Function: returns a particular column Returns : an array of floats Arguments: string id1 get_diagonal Title : get_diagonal Usage : $matrix->get_diagonal(); Function: returns the diagonal of the matrix Returns : an array of float Arguments: string id1 print_matrix Title : print_matrix Usage : $matrix->print_matrix(); Function: returns a string of the matrix in phylip format Returns : a string Arguments: _matrix Title : _matrix Usage : $matrix->_matrix(); Function: get/set for hash reference of the pointers to the value matrix Returns : hash reference Arguments: hash reference names Title : names Usage : $matrix->names(); Function: get/set for array ref of names of sequences Returns : an array reference Arguments: an array reference program Title : program Usage : $matrix->program(); Function: get/set for the program name generating this matrix Returns : string Arguments: string _values Title : _values Usage : $matrix->_values(); Function: get/set for array ref of the matrix containing distance values Returns : an array reference Arguments: an array reference Bio::Matrix::MatrixI implementation matrix_id Title : matrix_id Usage : my $id = $matrix->matrix_id Function: Get/Set the matrix ID Returns : scalar value Args : [optional] new id value to store matrix_name Title : matrix_name Usage : my $name = $matrix->matrix_name(); Function: Get/Set the matrix name Returns : scalar value Args : [optional] new matrix name value column_header Title : column_header Usage : my $name = $matrix->column_header(0) Function: Gets the column header for a particular column number Returns : string Args : integer row_header Title : row_header Usage : my $name = $matrix->row_header(0) Function: Gets the row header for a particular row number Returns : string Args : integer column_num_for_name Title : column_num_for_name Usage : my $num = $matrix->column_num_for_name($name) Function: Gets the column number for a particular column name Returns : integer Args : string row_num_for_name Title : row_num_for_name Usage : my $num = $matrix->row_num_for_name($name) Function: Gets the row number for a particular row name Returns : integer Args : string num_rows Title : num_rows Usage : my $rowcount = $matrix->num_rows; Function: Get the number of rows Returns : integer Args : none num_columns Title : num_columns Usage : my $colcount = $matrix->num_columns Function: Get the number of columns Returns : integer Args : none row_names Title : row_names Usage : my @rows = $matrix->row_names Function: The names of all the rows Returns : array in array context, arrayref in scalar context Args : none column_names Title : column_names Usage : my @columns = $matrix->column_names Function: The names of all the columns Returns : array in array context, arrayref in scalar context Args : none perl v5.14.2 2012-03-02 Bio::Matrix::PhylipDist(3pm)
All times are GMT -4. The time now is 02:44 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy