Sponsored Content
Top Forums UNIX for Dummies Questions & Answers how to get difference of two columns Post 302285487 by bogu0001 on Monday 9th of February 2009 04:08:48 AM
Old 02-09-2009
but its printing the input numbers as it is in output
I'm unable to get the result
Sorry for the trouble man
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Comparing Columns and printing the difference from a particular file

Gurus, I have one file which is having multiple columns and also this file is not always contain the exact columns; sometimes it contains 5 columns or 12 columns. Now, I need to find the difference from that particular file. Here is the sample file: param1 | 10 | 20 | 30 | param2 | 10 |... (6 Replies)
Discussion started by: buzzusa
6 Replies

2. Shell Programming and Scripting

Extract difference of two columns from different rows

Hello guys, Please help me to solve this problem. I have tried some awk commands but couldn't succeed. I have a tab delimited file where each record is separated by ------ and 4th column of each record is same. <INPUT FILE> ------ peon 53931587 53931821 ... (12 Replies)
Discussion started by: sam_2921
12 Replies

3. Shell Programming and Scripting

How to calculate the difference between two adjacent columns?

Dear All, I need to find the difference between two adjacent columns. The file is having 'i' columns and i need to find the difference between two adjacent columns (like $1 difference $2; $2 difference $3; .... and $(i-1) difference $i). I have used the following coding awk '{ for (i=1; i<NF;... (7 Replies)
Discussion started by: Fredrick
7 Replies

4. Shell Programming and Scripting

Compare two columns in two files and print the difference

one file . . importing table employee 119 . . importing table jobs 1 2nd file . . importing table employee 120 . . importing table jobs 1 and would like... (2 Replies)
Discussion started by: jhonnyrip
2 Replies

5. Shell Programming and Scripting

Difference between two columns and count

hi I am very new to shell scripting. i wanted to achieve this.. Col1 Col2 Col3 Col4 aa 23 bb 32 aa 34 bb 12 aa 45 bb 345 kk 20 ss 50 kk 30 ss 50 tt 10 vv 50 Desired output is Col1 Col2 Col3 Col4 Difference Count aa 23 bb ... (1 Reply)
Discussion started by: empyrean
1 Replies

6. Shell Programming and Scripting

[Solved] sum up third and second columns by 0 difference

Hi Friends, I have the following file chr1 1 2 chr1 2 3 chr1 3 4 chr1 4 5 chr1 5 6 chr1 19 20 chr1 20 21 chr1 21 22 I want to compare the third column of record 1 to second column of next record and if the difference is zero, consider its third column and match it to next record... (4 Replies)
Discussion started by: jacobs.smith
4 Replies

7. Shell Programming and Scripting

Calculate the difference of two columns and keep the line with specific value

Hi everyone, I am trying to find sty all day. I have two files: File 1: N 82 AAA A 1 0.67 N 83 BBB B 1 0.79 N 84 CCC C 1 0.11 File 2: N 82 AAA A 1 0.63 N 83 BBB B 1 0.03 N 84 CCC C 1 0.08 I want to calculate... (2 Replies)
Discussion started by: Tzole
2 Replies

8. Shell Programming and Scripting

Compute Difference and Edit second, third columns

Hi Friends, My input file is like this chr1 100 200 chr1 300 330 chr1 2000 2000 chr1 5000 5000 chr2 7790 7890 chr2 8000 8000 If the difference of third and second columns is zero, then subtract 500 from second column and add 500 to the third column. So, my output would be chr1... (1 Reply)
Discussion started by: jacobs.smith
1 Replies

9. Shell Programming and Scripting

Finding difference between two columns of unequal length

Hi, I have two files which look like this cat waitstate.txt 18.2 82.1 cat gostate.txt 5.6 5.8 6.1 6.3 6.6 6.9 7.2 7.5 (4 Replies)
Discussion started by: jamie_123
4 Replies

10. Shell Programming and Scripting

Calculate percentage difference between two columns

I have a input text file in this format: ITEM1 10.9 20.1 ITEM2 11.6 12 ITEM3 14 15.7 ITEM5 20 50.6 ITEM6 25 23.6 I want to print those lines which have more than 5% difference between second and third columns. (8 Replies)
Discussion started by: ctrld
8 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 03:40 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy