Sponsored Content
Top Forums Shell Programming and Scripting [Solved] sum up third and second columns by 0 difference Post 302701571 by rdrtx1 on Sunday 16th of September 2012 10:12:38 PM
Old 09-16-2012
awk -f t.awk b

where t.awk:

Code:
BEGIN {
 a_min=9999999;
 a_max=-1;
 lr="";
}
{
 if (lr != $1 && length(lr)>0) {
  print lr " " a_min " " a_max;
  a_min=9999999;
  a_max=-1;
 }
 if ($2 < a_min) a_min=$2;
 if ($3 > a_max) a_max=$3;
 lr=$1;
}
END {
  print lr " " a_min " " a_max;
}


Last edited by rdrtx1; 09-16-2012 at 11:25 PM..
This User Gave Thanks to rdrtx1 For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Sum of three columns - in 4N columns file

Hi All, happy new year. I have a file with 4xN columns like 0.0000e+00 0.0000e+00 7.199E+07 7.123E+07 6.976E+07 6.482E+07 5.256E+07 2.523E+07 0.0000e+00 0.0000e+00 8.641E+07 8.550E+07 8.373E+07 7.780E+07 6.309E+07 3.028E+07... (8 Replies)
Discussion started by: f_o_555
8 Replies

2. Shell Programming and Scripting

Difference between cksum and sum in unix

i get 2 different values when i give cksum and sum command. Are they 2 different algorithms? can someone explain how this is different (2 Replies)
Discussion started by: nidhink
2 Replies

3. Shell Programming and Scripting

[SOLVED] Awk one line to sum up a function

I need help with debugging an error in my awk script. I have a shell script with variable named U_new_i and want to pass it to awk for use in a summation. The original file have the following content. cat test.txt -2445.7132000000 -2444.9349000000 -2444.3295000000 -2443.1814000000 ... (0 Replies)
Discussion started by: Quantum_Dot
0 Replies

4. UNIX for Dummies Questions & Answers

[Solved] Remove Duplicates and Sum in a spreadsheet

Hi all, I have a problem hoping someone can help me. I have this spreadsheet : PC.333 PC.444 PC.555 PC.666 PC.777 0 0 ... (2 Replies)
Discussion started by: Giorgio C
2 Replies

5. Shell Programming and Scripting

Evaluate 2 columns, add sum IF two columns match on two rows

Hi all, I know this sounds suspiciously like a homework course; but, it is not. My goal is to take a file, and match my "ID" column to the "Date" column, if those conditions are true, add the total number of minutes worked and place it in this file, while not printing the original rows that I... (6 Replies)
Discussion started by: mtucker6784
6 Replies

6. UNIX for Dummies Questions & Answers

[Solved] Sum operation

I have file input w34 AG1 2 184 w35 AG1 6 552 w35 BG1 12 0 w35 CD1 7 0 w36 CG1 4 0 my output should be w34 AG1 2 184 0.991 w35 AG1 6 552 0.991 w35 BG1 12 0 1.000 w35 CD1 7 0... (3 Replies)
Discussion started by: radius
3 Replies

7. Shell Programming and Scripting

Get the SUM of TWO columns SEPARATELY by doing GROUP BY on other columns

My File looks like: "|" -> Field separator A|B|C|100|1000 D|E|F|1|2 G|H|I|0|7 D|E|F|1|2 A|B|C|10|10000 G|H|I|0|7 A|B|C|1|100 D|E|F|1|2 I need to do a SUM on Col. 5 and Col.6 by grouping on Col 1,2 & 3 My expected output is: A|B|C|111|11100 (2 Replies)
Discussion started by: machomaddy
2 Replies

8. Shell Programming and Scripting

Evaluate 2 columns, add sum IF two columns satisfy the condition

HI All, I'm embedding SQL query in Script which gives following output: Assignee Group Total ABC Group1 17 PQR Group2 5 PQR Group3 6 XYZ Group1 10 XYZ Group3 5 I have saved the above output in a file. How do i sum up the contents of this output so as to get following output: ... (4 Replies)
Discussion started by: Khushbu
4 Replies

9. UNIX for Beginners Questions & Answers

Group by columns and add sum in new columns

Dear Experts, I have input file which is comma separated, has 4 columns like below, BRAND,COUNTRY,MODEL,COUNT NIKE,USA,DUMMY,5 NIKE,USA,ORIGINAL,10 PUMA,FRANCE,DUMMY,20 PUMA,FRANCE,ORIGINAL,15 ADIDAS,ITALY,DUMMY,50 ADIDAS,ITALY,ORIGINAL,50 SPIKE,CHINA,DUMMY,1O And expected output add... (2 Replies)
Discussion started by: ricky1991
2 Replies

10. Shell Programming and Scripting

awk to calculate difference of split and sum the difference

In the awk I am trying to subtract the difference $3-$2 of each matching $4 before the first _ (underscore) and print that value in $13. I think the awk will do that, but added comments. What I am not sure off is how to add a line or lines that will add sum each matching $13 value and put it in... (2 Replies)
Discussion started by: cmccabe
2 Replies
Bio::Graphics::Glyph::wiggle_xyplot(3pm)		User Contributed Perl Documentation		  Bio::Graphics::Glyph::wiggle_xyplot(3pm)

NAME
Bio::Graphics::Glyph::wiggle_xyplot - An xyplot plot compatible with dense "wig"data SYNOPSIS
See <Bio::Graphics::Panel> and <Bio::Graphics::Glyph>. DESCRIPTION
This glyph works like the regular xyplot but takes value data in Bio::Graphics::Wiggle file format: reference = chr1 ChipCHIP Feature1 1..10000 wigfile=./test.wig ChipCHIP Feature2 10001..20000 wigfile=./test.wig ChipCHIP Feature3 25001..35000 wigfile=./test.wig The "wigfile" attribute gives a relative or absolute pathname to a Bio::Graphics::Wiggle format file. The data consist of a packed binary representation of the values in the feature, using a constant step such as present in tiling array data. Wigfiles are created using the Bio::Graphics::Wiggle module or the wiggle2gff3.pl script, currently both part of the gbrowse package. Alternatively, you can place an array of quantitative data directly in the "wigdata" attribute. This can be an arrayref of quantitative data starting at feature start and ending at feature end, or the data string returned by Bio::Graphics::Wiggle->export_to_wif64($start,$end). OPTIONS In addition to all the xyplot glyph options, the following options are recognized: Name Value Description ---- ----- ----------- basedir path Path to be used to resolve "wigfile" and "densefile" tags giving relative paths. Default is to use the current working directory. Absolute wigfile & densefile paths will not be changed. autoscale "local" or "global" If one or more of min_score and max_score options are absent, then these values will be calculated automatically. The "autoscale" option controls how the calculation is done. The "local" value will scale values according to the minimum and maximum values present in the window being graphed. "global" will use chromosome-wide statistics for the entire wiggle or dense file to find min and max values. smoothing method name Smoothing method: one of "mean", "max", "min" or "none" smoothing_window integer Number of values across which data should be smoothed. variance_band boolean If true, draw a grey band across entire plot showing mean and +/- 1 standard deviation (for wig files only). bicolor_pivot name Where to pivot the two colors when drawing bicolor plots. Options are "mean" and "zero". A numeric value can also be provided. pos_color color When drawing bicolor plots, the fill color to use for values that are above the pivot point. neg_color color When drawing bicolor plots, the fill color to use for values that are below the pivot point. SPECIAL FEATURE TAGS The glyph expects one or more of the following tags (attributes) in feature it renders: Name Value Description ---- ----- ----------- wigfile path name Path to the Bio::Graphics::Wiggle file or object for quantitative values. wigdata string Data exported from a Bio::Graphics::Wiggle in WIF format using its export_to_wif64() method. densefile path name Path to a Bio::Graphics::DenseFeature object (deprecated) denseoffset integer Integer offset to where the data begins in the Bio::Graphics::DenseFeature file (deprecated) densesize integer Integer size of the data in the Bio::Graphics::DenseFeature file (deprecated) BUGS
Please report them. SEE ALSO
Bio::Graphics::Panel, Bio::Graphics::Glyph, Bio::Graphics::Glyph::arrow, Bio::Graphics::Glyph::cds, Bio::Graphics::Glyph::crossbox, Bio::Graphics::Glyph::diamond, Bio::Graphics::Glyph::dna, Bio::Graphics::Glyph::dot, Bio::Graphics::Glyph::ellipse, Bio::Graphics::Glyph::extending_arrow, Bio::Graphics::Glyph::generic, Bio::Graphics::Glyph::graded_segments, Bio::Graphics::Glyph::heterogeneous_segments, Bio::Graphics::Glyph::line, Bio::Graphics::Glyph::pinsertion, Bio::Graphics::Glyph::primers, Bio::Graphics::Glyph::rndrect, Bio::Graphics::Glyph::segments, Bio::Graphics::Glyph::ruler_arrow, Bio::Graphics::Glyph::toomany, Bio::Graphics::Glyph::transcript, Bio::Graphics::Glyph::transcript2, Bio::Graphics::Glyph::translation, Bio::Graphics::Glyph::allele_tower, Bio::DB::GFF, Bio::SeqI, Bio::SeqFeatureI, Bio::Das, GD AUTHOR
Lincoln Stein <steinl@cshl.edu>. Copyright (c) 2007 Cold Spring Harbor Laboratory This package and its accompanying libraries is free software; you can redistribute it and/or modify it under the terms of the GPL (either version 1, or at your option, any later version) or the Artistic License 2.0. Refer to LICENSE for the full license text. In addition, please see DISCLAIMER.txt for disclaimers of warranty. perl v5.14.2 2012-02-20 Bio::Graphics::Glyph::wiggle_xyplot(3pm)
All times are GMT -4. The time now is 03:22 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy