Sponsored Content
Top Forums Shell Programming and Scripting Remove lines with unique information in indicated columns Post 302890938 by owwow14 on Sunday 2nd of March 2014 02:21:57 PM
Old 03-02-2014
Thank you for your response.

Quote:
Originally Posted by SriniShoo
Can you please explain more...because, from the data you shown above, how do you get the result you provided for identical cols 1 & 2.
Anyways, if you want unique col 1 & 2
Code:
awk '! a[$1 $2]++' <inputfile>

I think maybe I did not describe well my problem. I don't want unique Cols1 and 2. I need to remove all unique Col 2. (regardless of what is in Col 1.), In the example I provided, you can see that the Col 2 that remains are duplicates while the Col 2 that were unique are discarded.

Last edited by owwow14; 03-02-2014 at 03:31 PM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Remove lines with n columns

Hi folks - hope you are all well. I am trying to perform some pre-processing on a data file, to make sure it is in a valid format before performing a data upload. Each row of data in the file should consist of 10 comma delimited fields. Can anyone advise me of a sed/awk command that might... (2 Replies)
Discussion started by: Krispy
2 Replies

2. Shell Programming and Scripting

Remove lines, Sorted with Time based columns using AWK & SORT

Hi having a file as follows MediaErr.log 84 Server1 Policy1 Schedule1 master1 05/08/2008 02:12:16 84 Server1 Policy1 Schedule1 master1 05/08/2008 02:22:47 84 Server1 Policy1 Schedule1 master1 05/08/2008 03:41:26 84 Server1 Policy1 ... (1 Reply)
Discussion started by: karthikn7974
1 Replies

3. Shell Programming and Scripting

Remove All Lines Between Two Unique Lines

Hi all! Im wondering if its possible to remove all lines between two lines. Im working with a document like this: data1 data2 <Remove> data3 data4 </Remove> data5 data6 I need it to end up like this if that possible: data1 data2 data5 data6 There are multiple instances of... (2 Replies)
Discussion started by: Grizzly
2 Replies

4. Shell Programming and Scripting

awk : extracting unique lines based on columns

Hi, snp.txt CHR_A SNP_A BP_A_st BP_A_End CHR_B BP_B SNP_B R2 p-SNP_A p-SNP_B 5 rs1988728 74904317 74904318 5 74960646 rs1427924 0.377333 0.000740085 0.013930081 5 ... (12 Replies)
Discussion started by: genehunter
12 Replies

5. UNIX for Advanced & Expert Users

In a huge file, Delete duplicate lines leaving unique lines

Hi All, I have a very huge file (4GB) which has duplicate lines. I want to delete duplicate lines leaving unique lines. Sort, uniq, awk '!x++' are not working as its running out of buffer space. I dont know if this works : I want to read each line of the File in a For Loop, and want to... (16 Replies)
Discussion started by: krishnix
16 Replies

6. UNIX for Dummies Questions & Answers

remove duplicate lines based on two columns and judging from a third one

hello all, I have an input file with four columns like this with a lot of lines and for example, line 1 and line 5 match because the first 4 characters match and the fourth column matches too. I want to keep the line that has the lowest number in the third column. So I discard line 5.... (5 Replies)
Discussion started by: TheTransporter
5 Replies

7. Shell Programming and Scripting

How to merge columns into lines, using unique keys?

I would really appreciate a sulution for this : invoice# client# 5929 231 4358 231 2185 231 6234 231 1166 464 1264 464 3432 464 1720 464 9747 464 1133 791 4930 791 5496 791 6291 791 8681 989 3023 989 (2 Replies)
Discussion started by: hemo21
2 Replies

8. UNIX for Dummies Questions & Answers

Print unique lines without sort or unique

I would like to print unique lines without sort or unique. Unfortunately the server I am working on does not have sort or unique. I have not been able to contact the administrator of the server to ask him to add it for several weeks. (7 Replies)
Discussion started by: cokedude
7 Replies

9. Shell Programming and Scripting

Remove nullable columns in lines

Hi Every one, my requirement is to remove the null columns in line, comma delimiter used For example, A,11,20,30,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, B1,,,,,, gem,plum,kite,,,,gud,bad,,,,,,,,,,,,, B2,kiing,kong,height,,,,,,,,,,,,,,,,,,,,,,,,,rak,,,,,,,,,,,,, B1,,,,,,... (9 Replies)
Discussion started by: skpshell
9 Replies

10. Shell Programming and Scripting

Reading multiple values from multiple lines and columns and setting them to unique variables.

Hello, I would like to ask for help with csh script. An example of an input in .txt file is below, the number of lines varies from file to file and I have 2 or 3 columns with values. I would like to read all the values (probably one by one) and set them to independent unique variables that... (7 Replies)
Discussion started by: FMMOLA
7 Replies
GVPACK(1)						      General Commands Manual							 GVPACK(1)

NAME
gvpack - merge and pack disjoint graphs SYNOPSIS
gvpack [ -nguv? ] [ -mmargin ] [ -ooutfile ] [ -Gname=value ] [ files ] DESCRIPTION
gvpack reads in a stream of graphs, combines the graphs into a single layout, and produces a single graph serving as the union of the input graphs. The input graphs must be in dot format, and must have all necessary layout information. Acceptable input is produced by applying a Graphviz layout program, such as dot or neato, with no -T flag. By default, the packing is done at the cluster level. Thus, parts of one graph will not intrude into any top-level clusters or overlap any nodes or edges of another. The output of gvpack can be used to produce concrete output by applying neato -s -n2 with the desired -T flag. OPTIONS
The following options are supported: -g Combines the graphs at the graph level. This uses more space, but prevents parts of one graph from occurring between parts of another. -Gname=value Specifies attributes to be added to the resulting union graph. For example, this can be used to specify a graph label. -mmargin Packs the graphs allowing a margin of output points around the parts. -n Combines the graphs at the node level. Clusters are ignored in the packing. -ooutput Prints output to the file output. If not given, gvpack uses stdout. -u Don't pack the graphs. Just combine them into a single graph. -v Verbose mode. -? Prints usage information and exit. OPERANDS
The following operand is supported: files Names of files containing 1 or more graphs in dot format. If no files operand is specified, the standard input will be used. RETURN CODES
gvpack returns 0 if there were no problems, and non-zero otherwise. EXAMPLES
ccomps -x abc.dot | dot | gvpack | neato -s -n2 -Tps This pipeline decomposes the graph in abc.dot into its connected components, lays out each using dot, packs them all together again, and produces the final drawing in PostScript. Of course, there is nothing to prevent one from using different layouts for each component. BUGS
All the input graphs must be directed or undirected. An input graph should not have a label, since this will be used in its layout. Since gvpack ignores root graph labels, resulting layout may contain some extra space. gvpack unsets the bounding box attribute of all non-cluster subgraphs. AUTHORS
Emden R. Gansner <erg@research.att.com> SEE ALSO
gvpr(1), dot(1), neato(1), twopi(1), ccomps(1), libpack(3) 8 April 2003 GVPACK(1)
All times are GMT -4. The time now is 01:53 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy