Sponsored Content
Top Forums UNIX for Dummies Questions & Answers find common lines using just one column to compare and result with all columns Post 302303296 by vgersh99 on Thursday 2nd of April 2009 10:14:42 AM
Old 04-02-2009
Hmm.... I don't quite understand the logic how you determine the 'intersection'...
What does that mean:
Quote:
The result i´m looking for is intersection with A B C D F

so the answer here will be

7 8 9 2 3

So how do we do a intersection using to compare just the column 1 .
Can you try explaining again, please.

Last edited by vgersh99; 04-02-2009 at 11:23 AM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

To find all common lines from 'n' no. of files

Hi, I have one situation. I have some 6-7 no. of files in one directory & I have to extract all the lines which exist in all these files. means I need to extract all common lines from all these files & put them in a separate file. Please help. I know it could be done with the help of... (11 Replies)
Discussion started by: The Observer
11 Replies

2. Ubuntu

How to compare two columns and fetch the common data with additional column

Dear All, I am new to this forum and please ignore my little knowledge :p I have two types of data (a subset is given below) data version 1: 439798 2 1 451209 1 2 508696 2 1 555760 2 1 582757 1 2 582889 1 2 691827... (2 Replies)
Discussion started by: evoll
2 Replies

3. Shell Programming and Scripting

Compare a common field in two files and append a column from File 1 in File2

Hi Friends, I am new to Shell Scripting and need your help in the below situation. - I have two files (File 1 and File 2) and the contents of the files are mentioned below. - "Application handle" is the common field in both the files. (NOTE :- PLEASE REFER TO THE ATTACHMENT "Compare files... (2 Replies)
Discussion started by: Santoshbn
2 Replies

4. Shell Programming and Scripting

Compare two sample files and find common

Hi I have two sample files attached here one file contain entries in one column and second file contains entries in many columns I have to match entries of first file with entries in secon d file form secon column onwards and if matches write "match" in front of it. I tried several... (11 Replies)
Discussion started by: manigrover
11 Replies

5. Shell Programming and Scripting

Seperated by columns, merge in a file, sort them on common column

Hi All, I have 4 files in below format. I took them as an example. File 1: Cut from position 1-4 then 6-7 then 8-14 then rest left and make them as columns in one new file. Inserting character H to the initial of all line like HCTOT. CTOT 456787897 Low fever CTOR 556712345 High fever... (2 Replies)
Discussion started by: Mannu2525
2 Replies

6. Shell Programming and Scripting

Compare two columns and replacing it with value from third column!!

Hi, I am new to Unix and I am finding it hard to fix a particular logic. The context is as below. File 1 : This contains of 5 fields : Type | Bank Code | Account | Name | Date/Time 60|ABC123|TX123456|XXXX|YYYYMMDDHH:MM:SS 72|ABC123|MYD34561|XXXX|YYYYMMDDHH:MM:SS... (4 Replies)
Discussion started by: DJose
4 Replies

7. Shell Programming and Scripting

Compare 2 columns from the same file and print a value depending on the result

Hello Unix gurus, I have a file with this format (example values): label1 1 0 label2 1 0 label3 0.4 0.6 label4 0.5 0.5 label5 0.1 0.9 label6 0.9 0.1 in which: column 1 is a row label column 2 and 3 are values I would like to do a simple operation on this table and get the... (8 Replies)
Discussion started by: ksennin
8 Replies

8. Shell Programming and Scripting

Paste columns based on common column: multiple files

Hi all, I've multiple files. In this case 5. Space separated columns. Each file has 12 columns. Each file has 300-400K lines. I want to get the output such that if a value in column 2 is present in all the files then get all the columns of that value and print it side by side. Desired output... (15 Replies)
Discussion started by: genome
15 Replies

9. UNIX for Beginners Questions & Answers

Sort by record column, Compare with conditons and export the result

Hello, I am new to Unix and would like to seek a help, please. I have 2 files (file_1 and file_2), I need to perform the following actions. 1 ) Sort the both file by the column 26-36 (which is Invoice number) what is sort command with the column sort? 2) Compare the file_1.sorted and... (3 Replies)
Discussion started by: Usagi
3 Replies

10. Shell Programming and Scripting

Join columns across multiple lines in a Text based on common column using BASH

Hello, I have a file with 2 columns ( tableName , ColumnName) delimited by a Pipe like below . File is sorted by ColumnName. Table1|Column1 Table2|Column1 Table5|Column1 Table3|Column2 Table2|Column2 Table4|Column3 Table2|Column3 Table2|Column4 Table5|Column4 Table2|Column5 From... (6 Replies)
Discussion started by: nv186000
6 Replies
sets(3erl)						     Erlang Module Definition							sets(3erl)

NAME
sets - Functions for Set Manipulation DESCRIPTION
Sets are collections of elements with no duplicate elements. The representation of a set is not defined. This module provides exactly the same interface as the module ordsets but with a defined representation. One difference is that while this module considers two elements as different if they do not match ( =:= ), ordsets considers two elements as different if and only if they do not compare equal ( == ). DATA TYPES
set() as returned by new/0 EXPORTS
new() -> Set Types Set = set() Returns a new empty set. is_set(Set) -> bool() Types Set = term() Returns true if Set is a set of elements, otherwise false . size(Set) -> int() Types Set = term() Returns the number of elements in Set . to_list(Set) -> List Types Set = set() List = [term()] Returns the elements of Set as a list. from_list(List) -> Set Types List = [term()] Set = set() Returns an set of the elements in List . is_element(Element, Set) -> bool() Types Element = term() Set = set() Returns true if Element is an element of Set , otherwise false . add_element(Element, Set1) -> Set2 Types Element = term() Set1 = Set2 = set() Returns a new set formed from Set1 with Element inserted. del_element(Element, Set1) -> Set2 Types Element = term() Set1 = Set2 = set() Returns Set1 , but with Element removed. union(Set1, Set2) -> Set3 Types Set1 = Set2 = Set3 = set() Returns the merged (union) set of Set1 and Set2 . union(SetList) -> Set Types SetList = [set()] Set = set() Returns the merged (union) set of the list of sets. intersection(Set1, Set2) -> Set3 Types Set1 = Set2 = Set3 = set() Returns the intersection of Set1 and Set2 . intersection(SetList) -> Set Types SetList = [set()] Set = set() Returns the intersection of the non-empty list of sets. is_disjoint(Set1, Set2) -> bool() Types Set1 = Set2 = set() Returns true if Set1 and Set2 are disjoint (have no elements in common), and false otherwise. subtract(Set1, Set2) -> Set3 Types Set1 = Set2 = Set3 = set() Returns only the elements of Set1 which are not also elements of Set2 . is_subset(Set1, Set2) -> bool() Types Set1 = Set2 = set() Returns true when every element of Set 1 is also a member of Set2 , otherwise false . fold(Function, Acc0, Set) -> Acc1 Types Function = fun (E, AccIn) -> AccOut Acc0 = Acc1 = AccIn = AccOut = term() Set = set() Fold Function over every element in Set returning the final value of the accumulator. filter(Pred, Set1) -> Set2 Types Pred = fun (E) -> bool() Set1 = Set2 = set() Filter elements in Set1 with boolean function Fun . SEE ALSO
ordsets(3erl) , gb_sets(3erl) Ericsson AB stdlib 1.17.3 sets(3erl)
All times are GMT -4. The time now is 03:48 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy