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
struct::set(n)							Tcl Data Structures						    struct::set(n)

__________________________________________________________________________________________________________________________________________________

NAME
struct::set - Procedures for manipulating sets SYNOPSIS
package require Tcl 8.0 package require struct::set ?2.2.3? ::struct::set empty set ::struct::set size set ::struct::set contains set item ::struct::set union ?set1...? ::struct::set intersect ?set1...? ::struct::set difference set1 set2 ::struct::set symdiff set1 set2 ::struct::set intersect3 set1 set2 ::struct::set equal set1 set2 ::struct::set include svar item ::struct::set exclude svar item ::struct::set add svar set ::struct::set subtract svar set ::struct::set subsetof A B _________________________________________________________________ DESCRIPTION
The ::struct::set namespace contains several useful commands for processing finite sets. It exports only a single command, struct::set. All functionality provided here can be reached through a subcommand of this command. Note: As of version 2.2 of this package a critcl based C implementation is available. This implementation however requires Tcl 8.4 to run. COMMANDS
::struct::set empty set Returns a boolean value indicating if the set is empty (true), or not (false). ::struct::set size set Returns an integer number greater than or equal to zero. This is the number of elements in the set. In other words, its cardinality. ::struct::set contains set item Returns a boolean value indicating if the set contains the element item (true), or not (false). ::struct::set union ?set1...? Computes the set containing the union of set1, set2, etc., i.e. "set1 + set2 + ...", and returns this set as the result of the com- mand. ::struct::set intersect ?set1...? Computes the set containing the intersection of set1, set2, etc., i.e. "set1 * set2 * ...", and returns this set as the result of the command. ::struct::set difference set1 set2 Computes the set containing the difference of set1 and set2, i.e. ("set1 - set2") and returns this set as the result of the command. ::struct::set symdiff set1 set2 Computes the set containing the symmetric difference of set1 and set2, i.e. ("(set1 - set2) + (set2 - set1)") and returns this set as the result of the command. ::struct::set intersect3 set1 set2 This command is a combination of the methods intersect and difference. It returns a three-element list containing "set1*set2", "set1-set2", and "set2-set1", in this order. In other words, the intersection of the two parameter sets, and their differences. ::struct::set equal set1 set2 Returns a boolean value indicating if the two sets are equal (true) or not (false). ::struct::set include svar item The element item is added to the set specified by the variable name in svar. The return value of the command is empty. This is the equivalent of lappend for sets. If the variable named by svar does not exist it will be created. ::struct::set exclude svar item The element item is removed from the set specified by the variable name in svar. The return value of the command is empty. This is a near-equivalent of lreplace for sets. ::struct::set add svar set All the element of set are added to the set specified by the variable name in svar. The return value of the command is empty. This is like the method include, but for the addition of a whole set. If the variable named by svar does not exist it will be created. ::struct::set subtract svar set All the element of set are removed from the set specified by the variable name in svar. The return value of the command is empty. This is like the method exclude, but for the removal of a whole set. ::struct::set subsetof A B Returns a boolean value indicating if the set A is a true subset of or equal to the set B (true), or not (false). REFERENCES
BUGS, IDEAS, FEEDBACK This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such in the category struct :: set of the Tcllib SF Trackers [http://sourceforge.net/tracker/?group_id=12883]. Please also report any ideas for enhancements you may have for either package and/or documentation. KEYWORDS
cardinality, difference, emptiness, exclusion, inclusion, intersection, membership, set, symmetric difference, union CATEGORY
Data structures COPYRIGHT
Copyright (c) 2004-2008 Andreas Kupries <andreas_kupries@users.sourceforge.net> struct 2.2.3 struct::set(n)
All times are GMT -4. The time now is 02:58 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy