Sponsored Content
Top Forums Shell Programming and Scripting need to remove duplicates based on key in first column and pattern in last column Post 302449503 by agama on Monday 30th of August 2010 08:39:03 PM
Old 08-30-2010
Yes, for the fist record with key 'k' the value of b[k] will be 0 or the empty string depending on whether the value is used in an equation or as a string. In this case, the expression is the comparison of the empty string with some non-empty string; a non-empty string will always test greater than "". Thus, for the first instance of the key the value will be saved.

Quote:
Originally Posted by script_op2a
And from what I understand about if statements in awk, they cannot be 0.
I'm not quite sure what you mean by an if statement cannot be zero.
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

joining files based on key column

Hi I have to join two files based on 1st column where 4th column of a2.txt=at and take 2nd column of a1.txt and 3rd column of a2.txt and check against source files ,if matches list those source file names. a1.txt a1|20090809|20090810 a2|20090907|20090908 a2.txt a1|d|file1.txt|at... (9 Replies)
Discussion started by: akil
9 Replies

2. Shell Programming and Scripting

How can i delete the duplicates based on one column of a line

I have my data something like this (08/03/2009 22:57:42.414)(:) king aaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbb (08/03/2009 22:57:42.416)(:) John cccccccccccc cccccvssssssssss baaaaa (08/03/2009 22:57:42.417)(:) Michael ddddddd tststststtststts (08/03/2009 22:57:42.425)(:) Ravi... (11 Replies)
Discussion started by: rdhanek
11 Replies

3. UNIX for Dummies Questions & Answers

Remove duplicates based on a column in fixed width file

Hi, How to output the duplicate record to another file. We say the record is duplicate based on a column whose position is from 2 and its length is 11 characters. The file is a fixed width file. ex of Record: DTYU12333567opert tjhi kkklTRG9012 The data in bold is the key on which... (1 Reply)
Discussion started by: Qwerty123
1 Replies

4. Shell Programming and Scripting

Remove duplicates based on the two key columns

Hi All, I needs to fetch unique records based on a keycolumn(ie., first column1) and also I needs to get the records which are having max value on column2 in sorted manner... and duplicates have to store in another output file. Input : Input.txt 1234,0,x 1234,1,y 5678,10,z 9999,10,k... (7 Replies)
Discussion started by: kmsekhar
7 Replies

5. Shell Programming and Scripting

remove duplicates based on single column

Hello, I am new to shell scripting. I have a huge file with multiple columns for example: I have 5 columns below. HWUSI-EAS000_29:1:105 + chr5 76654650 AATTGGAA HHHHG HWUSI-EAS000_29:1:106 + chr5 76654650 AATTGGAA B@HYL HWUSI-EAS000_29:1:108 + ... (4 Replies)
Discussion started by: Diya123
4 Replies

6. Shell Programming and Scripting

Request to check:remove duplicates only in first column

Hi all, I have an input file like this Now I have to remove duplicates only in first column and nothing has to be changed in second and third column. so that output would be Please let me know scripting regarding this (20 Replies)
Discussion started by: manigrover
20 Replies

7. Shell Programming and Scripting

Remove duplicates within row and separate column

Hi all I have following kind of input file ESR1 PA156 leflunomide PA450192 leflunomide CHST3 PA26503 docetaxel Pa4586; thalidomide Pa34958; decetaxel docetaxel docetaxel I want to remove duplicates and I want to separate anything before and after PAxxxx entry into columns or... (1 Reply)
Discussion started by: manigrover
1 Replies

8. Shell Programming and Scripting

Remove Duplicates on multiple Key Columns and get the Latest Record from Date/Time Column

Hi Experts , we have a CDC file where we need to get the latest record of the Key columns Key Columns will be CDC_FLAG and SRC_PMTN_I and fetch the latest record from the CDC_PRCS_TS Can we do it with a single awk command. Please help.... (3 Replies)
Discussion started by: vijaykodukula
3 Replies

9. Shell Programming and Scripting

Remove duplicates according to their frequency in column

Hi all, I have huge a tab-delimited file with the following format and I want to remove the duplicates according to their frequency based on Column2 and Column3. Column1 Column2 Column3 Column4 Column5 Column6 Column7 1 user1 access1 word word 3 2 2 user2 access2 ... (10 Replies)
Discussion started by: corfuitl
10 Replies
VARIANT_DIV(3)								 1							    VARIANT_DIV(3)

variant_div - Returns the result from dividing two variants

SYNOPSIS
mixed variant_div (mixed $left, mixed $right) DESCRIPTION
Divides $left by $right and returns the result. PARAMETERS
o $left - The left operand. o $right - The right operand. Note As with all the variant arithmetic functions, the parameters for this function can be either a PHP native type (integer, string, floating point, boolean or NULL), or an instance of a COM, VARIANT or DOTNET class. PHP native types will be converted to variants using the same rules as found in the constructor for the "VARIANT" class. COM and DOTNET objects will have the value of their default property taken and used as the variant value. The variant arithmetic functions are wrappers around the similarly named functions in the COM library; for more information on these functions, consult the MSDN library. The PHP functions are named slightly differently; for example variant_add(3) in PHP cor- responds to VarAdd() in the MSDN documentation. RETURN VALUES
Variant Division Rules +--------------------------------------------------+---------------------------------------------------+ | If | | | | | | | Then | | | | +--------------------------------------------------+---------------------------------------------------+ |Both expressions are of the string, date, charac- | | |ter, boolean type | | | | | | | Double is returned | | | | |One expression is a string type and the other a | | |character | | | | | | | Division and a double is returned | | | | |One expression is numeric and the other is a | | |string | | | | | | | Division and a double is returned. | | | | | Both expressions are numeric | | | | | | | Division and a double is returned | | | | | Either expression is NULL | | | | | | | NULL is returned | | | | | $right is empty and $left is anything but empty | | | | | | | A com_exception with code DISP_E_DIVBYZERO is | | | thrown | | | | |$left is empty and $right is anything but empty. | | | | | | | 0 as type double is returned | | | | | Both expressions are empty | | | | | | | A com_exception with code DISP_E_OVERFLOW is | | | thrown | | | | +--------------------------------------------------+---------------------------------------------------+ SEE ALSO
variant_idiv(3). PHP Documentation Group VARIANT_DIV(3)
All times are GMT -4. The time now is 12:07 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy