Sponsored Content
Full Discussion: differentiating two sets
Top Forums Shell Programming and Scripting differentiating two sets Post 302268174 by radoulov on Monday 15th of December 2008 06:22:27 AM
Old 12-15-2008
Something like this may work with GNU Awk:

Code:
awk 'BEGIN {
  FS = OFS = "\57"
  }
NR == FNR {
  t = $NF; NF = NF - 1
 _[$0] = t; next
 }
{
  t = NF; NF = NF - 1
  if ($0 in _ && _[$0] > t)
    print $0, t
}' set2 set1

For other awks try this:

Code:
awk 'BEGIN {
  FS = OFS = "\57"
  }
NR == FNR {
  t = $NF; sub(/\/[^\/]*$/, "")
 _[$0] = t; next
 }
{
  t = $NF; sub(/\/[^\/]*$/, "")
  if ($0 in _ && _[$0] > t)
    print $0, t
}' set2 set1

 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Character Sets

Hi I was just wondering if there was a way in which i could find out the character set used in a file in HP-UX. ie Whether it is Unicode, UTF-8,ascii etc. Regards (3 Replies)
Discussion started by: PradeepRed
3 Replies

2. Virtualization and Cloud Computing

Clouds (Partially Order Sets) - Streams (Linearly Ordered Sets) - Part 2

timbass Sat, 28 Jul 2007 10:07:53 +0000 Originally posted in Yahoo! CEP-Interest Here is my follow-up note on posets (partially ordered sets) and tosets (totally or linearly ordered sets) as background set theory for event processing, and in particular CEP and ESP. In my last note, we... (0 Replies)
Discussion started by: Linux Bot
0 Replies

3. Programming

How An Application Sets The Ip Options???

Hello Friends, I'm involved in test the UDP/IP source code. As you might be knowing, IPv4 provides several options: like Loose Source and Record Route (LSRR), Strict Source and Record Route (SSRR) etc. I wanted to test the above mentioned IP options. My strategy is to write a test application... (3 Replies)
Discussion started by: aamirglb
3 Replies

4. Shell Programming and Scripting

differentiating two sets for filenames????

set 1 ./abc@@/main/61 ./def.cpp@@/main/13 ./fgh.cpp@@/main/16 ./ijk.cpp@@/main/12 ./mln.cpp@@/main/9 ./uvw.cpp@@/main/30 set2 ./eww@@/main/61 ./def.cpp@@/main/13 ./xxx.cpp@@/main/26 ./kkk.cpp@@/main/72 ./qqq.cpp@@/main/19 ./fgh.cpp@@/main/16 I have two sets with filenames in... (13 Replies)
Discussion started by: skyineyes
13 Replies

5. Solaris

FSS and processor sets

I read somewhere which says """FSS can be assigned to processor sets, resulting in more sensitive control of priorities on a server than raw processor sets"" can any one tell me how we can assign FSS to processor set and how it works ? Thanx (2 Replies)
Discussion started by: fugitive
2 Replies

6. UNIX for Dummies Questions & Answers

Parameters to check while differentiating two servers

Hi All, I have two solaris servers. Please tell me what all parameters i can check to find out the difference between two servers. how to differentiate based on H/W,S/W etc like i have two servers spdwa013 $ uname -an SunOS spdwa013 5.8 Generic_117350-61 sun4u sparc SUNW,Sun-Fire-480R ... (1 Reply)
Discussion started by: usha rao
1 Replies

7. Shell Programming and Scripting

differentiating PIDs under 200

Hey, So I'm new to shell scripting, and I'm trying to write one for my lab that will keep down the work load by deleting processes that are left over from previous sessions. Basically I want it to do three things. 1) Check the processes running 2) See if that person is logged on. 3) if... (2 Replies)
Discussion started by: prgoodwin
2 Replies

8. UNIX for Advanced & Expert Users

sets the remote server's name

Hi all, does any one have any idea on how to sets the remote server's name on ubuntu terminal tabs, without making any changes to the remote server? for example if i'm working on ssh root@test1 i would like it to be shown on the tittle's tab and if i connect on another it would do the same... (7 Replies)
Discussion started by: charli1
7 Replies

9. Shell Programming and Scripting

Merging and differentiating 2 files

I have 2 csv files say file1 and file2. Based on 2 columns, I want to check if the values of file1 is present in file 2 or not. If it's not present then it should create a file with the values which are not present. Basically I want the minus between 2 files but based on 2 columns but the output... (2 Replies)
Discussion started by: Gangadhar Reddy
2 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 04:14 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy