Sponsored Content
Top Forums Shell Programming and Scripting Print lines that contain a value in a specific column shared by more than 1 entity in another col Post 302869781 by owwow14 on Thursday 31st of October 2013 07:32:58 AM
Old 10-31-2013
Print lines that contain a value in a specific column shared by more than 1 entity in another col

I want to expand on a question that I just asked here:

I want to extract only those values in Column 2 that are shared by at least 2 unique values in Column 2.

Using the same input (in this case 3- tab-separated columns):
Code:
waterline-n    below-sheath-v    14.8097 
dock-n    below-sheath-v     14.5095 
waterline-n    below-steel-n    11.0330 
picnic-n    below-steel-n    12.2277 
wavefront-n    at-part-of-variance-n    18.4888 
wavefront-n    between-part-of-variance-n    17.0656
audience-b    between-part-of-variance-n    17.6346 
game-n    between-part-of-variance-n    14.9652 
whereabouts-n    become-rediscovery-n    11.3556 
whereabouts-n    get-tee-n    10.9091

For the following desired output:
Code:
waterline-n    below-sheath-v    14.8097 
dock-n    below-sheath-v     14.5095 
waterline-n    below-steel-n    11.0330
picnic-n    below-steel-n    12.2277 
wavefront-n    between-part-of-variance-n    17.0656 
audience-b    between-part-of-variance-n    17.6346 
game-n    between-part-of-variance-n    14.9652

How can I do this using awk / grep?

Last edited by owwow14; 10-31-2013 at 08:39 AM.. Reason: Please use code tags
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Question about sort specific column and print other column at the same time !

Hi, This is my input file: ali 5 usa abc abu 4 uk bca alan 6 brazil bac pinky 10 utah sdc My desired output: pinky 10 utah sdc alan 6 brazil bac ali 5 usa abc abu 4 uk bca Based on the column two, I want to do the descending order and print out other related column at the... (3 Replies)
Discussion started by: patrick87
3 Replies

2. UNIX for Dummies Questions & Answers

print a specific column

Hi I want to print column2 if column1 is b with: awk '$1==b {print $2}' infile > outfile infile a 1 b 2 c 3 b 4 e 5 b 6 the outfile is empty. it should look like this: 2 4 6 (2 Replies)
Discussion started by: jdhahbi
2 Replies

3. Shell Programming and Scripting

print first few lines, then apply regex on a specific column to print results.

abc.dat tty cpu tin tout us sy wt id 0 0 7 3 19 71 extended device statistics r/s w/s kr/s kw/s wait actv wsvc_t asvc_t %w %b device 0.0 133.2 0.0 682.9 0.0 1.0 0.0 7.2 0 79 c1t0d0 0.2 180.4 0.1 5471.2 3.0 2.8 16.4 15.6 15 52 aaaaaa1-xx I want to skip first 5 line... (4 Replies)
Discussion started by: kchinnam
4 Replies

4. UNIX for Advanced & Expert Users

Print line based on highest value of col (B) and repetion of values in col (A)

Hello everyone, I am writing a script to process data from the ATP world tour. I have a file which contains: t=540 y=2011 r=1 p=N409 t=540 y=2011 r=2 p=N409 t=540 y=2011 r=3 p=N409 t=540 y=2011 r=4 p=N409 t=520 y=2011 r=1 p=N409 t=520 y=2011 r=2 p=N409 t=520 y=2011 r=3 p=N409 The... (4 Replies)
Discussion started by: imahmoud
4 Replies

5. Shell Programming and Scripting

Print Specific lines when found specific character

Hello all, I have thousand file input like this: file1: $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ $$ | | | |$$ $$ UERT | TTYH | TAFE | FRFG |$$ $$______|______|________|______|$$ $$ | | | |$$ $$ 1 | DISK | TR1311 | 1 |$$ $$ 1 |... (4 Replies)
Discussion started by: attila
4 Replies

6. Shell Programming and Scripting

Delete column with exact string in specific col

Hi, my file structur looks like File structure looks: GeneID protein_gi Symbol 1246500 10954455 repA1 1246501 10954457 repA2 1246502 10954458 leuA But some of the cases do not have record for protein id. for example: 1343044 - orf01 I want to remove those rows. But I tried awk... (9 Replies)
Discussion started by: smitra
9 Replies

7. Shell Programming and Scripting

awk Print New Column For Every Two Lines and Match On Multiple Column Values to print another column

Hi, My input files is like this axis1 0 1 10 axis2 0 1 5 axis1 1 2 -4 axis2 2 3 -3 axis1 3 4 5 axis2 3 4 -1 axis1 4 5 -6 axis2 4 5 1 Now, these are my following tasks 1. Print a first column for every two rows that has the same value followed by a string. 2. Match on the... (3 Replies)
Discussion started by: jacobs.smith
3 Replies

8. Shell Programming and Scripting

Print lines in which value in specified Col is NOT unique

Hi everyone, I have the following file, which is a 3 column tab-delineated. cat big 24 cat small 13 cat red 63 dog big 34 chicken plays 39 fish red 294 I would like to print only those lines, in which the value in Col2 is repeated. Thus, given the above input file, the desired... (7 Replies)
Discussion started by: owwow14
7 Replies

9. Shell Programming and Scripting

How to print multiple specific column after a specific word?

Hello.... Pls help me (and sorry my english) :) So I have a file (test.txt) with 1 long line.... for example: isgc jsfh udgf osff 8462 error iwzr 653 idchisfb isfbisfb sihfjfeb isfhsi gcz eifh How to print after the "error" word the 2nd 4th 5th and 7th word?? output well be: 653 isfbisfb... (2 Replies)
Discussion started by: marvinandco
2 Replies

10. UNIX for Beginners Questions & Answers

How to print lines from a files with specific start and end patterns and pick only the last lines?

Hi, I need to print lines which are matching with start pattern "SELECT" and END PATTERN ";" and only select the last "select" statement including the ";" . I have attached sample input file and the desired input should be as: INPUT FORMAT: SELECT ABCD, DEFGH, DFGHJ, JKLMN, AXCVB,... (5 Replies)
Discussion started by: nani2019
5 Replies
average_images(1)				       The Computational Morphometry Toolkit					 average_images(1)

NAME
average_images - Average images SYNOPSIS
average_images [options] image0 ... DESCRIPTION
This tool computes pixelwiase average, variance, standard deviation, z-score, or entropy images from a list of user-provided intensity images. OPTIONS
Global Toolkit Options (these are shared by all CMTK tools) --help Write list of basic command line options to standard output. --help-all Write complete list of basic and advanced command line options to standard output. --wiki Write list of command line options to standard output in MediaWiki markup. --man Write man page source in 'nroff' markup to standard output. --version Write toolkit version to standard output. --echo Write the current command line to standard output. --verbose-level <integer> Set verbosity level. --verbose, -v Increment verbosity level by 1 (deprecated; supported for backward compatibility). --threads <integer> Set maximum number of parallel threads (for POSIX threads and OpenMP). Main Options --mode Mode of averaging operation Supported values: "avg", "var", "stdev", "zscore", "entropy", where the default is "avg", or use one of the following: --avg Compute average (i.e., mean) image [This is the default] --var Compute variance image --stdev Compute standard deviation image --zscore Compute z-score image --entropy Compute pixel-by-pixel population entropy image Data Preprocessing --log, -l Apply log to input data --abs, -a Use absolute input values --normalize-mean-stdev, -n Normalize image intensities using means and standard deviations --set-padding-value <double> Define padding value in input images [Default: disabled] Output Options --outfile-name <string>, -o <string> Output file name [Default: average.nii ] --type Scalar data type of output image. Supported values: "float", "double", where the default is "float", or use one of the following: --float Single-precision float. [This is the default] --double Double-precision float. AUTHORS
Torsten Rohlfing, with contributions from Michael P. Hasak, Greg Jefferis, Calvin R. Maurer, and Daniel B. Russakoff LICENSE
http://www.fsf.org/licensing/licenses/gpl.html BUGS
Report bugs at http://nitrc.org/projects/cmtk/ ACKNOWLEDGMENTS
From April 2009 through September 2011, CMTK Development and Maintenance was supported by the National Institute of Biomedical Imaging and Bioengineering under Grant No.R01 EB008381 (PI: Torsten Rohlfing). CMTK 2.2.2 Jul 20 2012 average_images(1)
All times are GMT -4. The time now is 09:12 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy