Sponsored Content
Top Forums Shell Programming and Scripting Files common in two sets ??? How to find ?? Post 302268111 by yongitz on Monday 15th of December 2008 04:19:00 AM
Old 12-15-2008
grep -f set1 set2
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

find common elements in 2 files (for loop)

Hi, i'm new here (and to scripting too). I was hoping for some help in comparing two files. i have a file called 'file1' with a list of names in the following format: adam jones paul higgins kelly lowe i also have another file which may contain some of the names but with a lot of... (4 Replies)
Discussion started by: ibking
4 Replies

2. 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

3. UNIX for Dummies Questions & Answers

how to find common words and take them out from two files

Hi, everyone, Let's say, we have xxx.txt A 1 2 3 4 5 C 1 2 3 4 5 E 1 2 3 4 5 yyy.txt A 1 2 3 4 5 B 1 2 3 4 5 C 1 2 3 4 5 D 1 2 3 4 5 E 1 2 3 4 5 First I match the first column I find intersection (A,C, E), then I want to take those lines with ACE out from yyy.txt, like A 1... (11 Replies)
Discussion started by: kaixinsjtu
11 Replies

4. UNIX for Advanced & Expert Users

Find common Strings in two large files

Hi , I have a text file in the format DB2: DB2: WB: WB: WB: WB: and a second text file of the format Time=00:00:00.473 Time=00:00:00.436 Time=00:00:00.016 Time=00:00:00.027 Time=00:00:00.471 Time=00:00:00.436 the last string in both the text files is of the... (4 Replies)
Discussion started by: kanthrajgowda
4 Replies

5. Shell Programming and Scripting

Script to find NOT common strings in two files

Hi all, I'd like you to help or give any advise about the following: I have two (2) files, file1 and file2, both files have information common to each other. The contents of file1 is a subset of the contents of file2: file1: errormsgadmin esdp esgservices esignipa iprice ipvpn irm... (0 Replies)
Discussion started by: hnux
0 Replies

6. 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

7. Shell Programming and Scripting

Find Common Values Across Two Files

Hi All, I have two files like below: File1 MYFILE_28012012_1112.txt|4 MYFILE_28012012_1113.txt|51 MYFILE_28012012_1114.txt|57 MYFILE_28012012_1115.txt|57 MYFILE_28012012_1116.txt|57 MYFILE_28012012_1117.txt|57 File2 MYFILE_28012012_1110.txt|57 MYFILE_28012012_1111.txt|57... (2 Replies)
Discussion started by: angshuman
2 Replies

8. Shell Programming and Scripting

Find common files between two directories

I have two directories Dir 1 /home/sid/release1 Dir 2 /home/sid/release2 I want to find the common files between the two directories Dir 1 files /home/sid/release1>ls -lrt total 16 -rw-r--r-- 1 sid cool 0 Jun 19 12:53 File123 -rw-r--r-- 1 sid cool 0 Jun 19 12:53... (5 Replies)
Discussion started by: sidnow
5 Replies

9. Shell Programming and Scripting

Find common lines between all of the files in one folder

Could it be possible to find common lines between all of the files in one folder? Just like comm -12 . So all of the files two at a time. I would like all of the outcomes to be written to a different files, and the file names could be simply numbers - 1 , 2 , 3 etc. All of the file names contain... (19 Replies)
Discussion started by: Eve
19 Replies
af_sets(3)						    Attribute Filesystem (AtFS) 						af_sets(3)

NAME
af_initset, af_nrofkeys, af_setgkey, af_setaddkey, af_setrmkey, af_setposrmkey, af_sortset, af_subset, af_copyset, af_intersect, af_union, af_diff - AtFS operations on key sets SYNOPSIS
#include <atfs.h> int af_initset (Af_set *set) int af_nrofkeys (Af_set *set) int af_setgkey (Af_set *set, int position, Af_key *key) int af_setaddkey (Af_set *set, int position, Af_key *key) int af_setrmkey (Af_set *set, Af_key *key) int af_setposrmkey (Af_set *set, int position) int af_sortset (Af_set *set, char *attrname) int af_subset (Af_set *set, Af_attrs *attrbuf, Af_set *subset) int af_copyset (Af_set *source, Af_set *destination) int af_intersect (Af_set *set1, Af_set *set2, Af_set *newset) int af_union (Af_set *set1, Af_set *set2, Af_set *newset) int af_diff (Af_set *set1, Af_set *set2, *Af_set newset) DESCRIPTION
Sets in AtFS are ordered collections of keys. The structure of sets is the following typedef struct { int af_nkeys; int af_setlen; Af_key *af_klist; } Af_set; The list of keys in a set is a linear list, residing in allocated memory. The list has no holes, so that positions 0 through af_nkeys-1 are occupied with valid keys. Set functions returning a set require a pointer to an empty set structure as argument. af_initset initializes a set. af_nrofkeys returns the number of valid keys in the given set. af_setgkey delivers the filekey, stored at position position in the identified set. The result is passed in the buffer key. Typically you use af_setgkey to run through a set and perform a special action on each key. The following code sequence does this job: Af_key key; Af_set set; af_initset (&set); ... for (i = 0; i < af_nrofkeys (&set); i++) { af_setgkey (&set, i, &key); /* process key */ ... } af_setaddkey introduces a new filekey to an existing set at the given position. All following keys are moved back by one position. The constant AF_LASTPOS given as position argument leads to adding the new filekey at the end of the set. af_setrmkey (af_setposrmkey) removes the given filekey (the filekey at position position) from the specified set. Holes generated by delet- ing single keys from a set are eliminated by condensing the set. All following keys are moved one position forth in the set. af_sortset sorts a given set of object keys by the values of the named attribute. The set is sorted in increasing order. Increasing order means, that the lowest value occurs first in the set. Af_user structures are compared by username first and by userdomain, if the names are equal (user host will not be taken into account). Version numbers are ordered in natural order, busy versions first. In atfs.h you can find a list of attribute names naming the standard attributes. All other attribute names are presumed to be user defined attributes. While sorting by the values of an user defined attribute, all ASOs that do not have the named attribute are added at the end of the resulting (sorted) set. Sorting of user defined attributes with multiple values bases on simple text comparison with the order of the values taken as it is. The length of the given attribute name is limited. This limit is defined by the constant AF_UDANAMLEN in atfs.h. af_subset does a retrieve operation (similar to af_find - manual page af_retrieve(3)) on a given set of object keys. Af_subset takes an attribute buffer (attrbuf) with all desired attributes set to an appropriate value as argument. The attribute buffer should be initialized by af_initattrs (manual page af_retrieve(3)) beforehand. af_subset returns it's result in a new set, the original set remains unchanged. af_copyset for copying sets (really! =:-). af_intersect, af_union and af_diff build intersections, unions, and differences between two sets. The result is a new set, where all keys taken from the first argument set (set1) occur first, and the keys from the second argument set (set2) afterwards. You may gibe one of set1 or set2 as resultset. In that case, the original set get lost and is dropped implicitely. Sets generated by af_copyset, af_subset, af_intersect, af_union, or af_diff should be released by af_dropset as soon as they are not used any longer. SEE ALSO
af_retrieve(3) DIAGNOSTICS
Upon error, -1 or a nil pointer (depending on the return type) is returned and af_errno is set to the corresponding error number. AtFS-1.71 Fri Jun 25 14:33:20 1993 af_sets(3)
All times are GMT -4. The time now is 05:36 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy