Ok this is the perl script which will do the job for your file format .
Just replace abc.txt with the file name you have. Alternatively if you want to run it for a sequence of files from command line , remove the open stmts and write while(<>) instead of while (<$fh>)
it could be run as cat file1 file2 | perl scriptname
Note:- I have added extra comments and self explanatory variable names for easy understanding
And reg the perl script replacing awk, I generally go with perl when ever there are more computations and the files tend to be large. However, its a matter of personal perception. Choose the one which suits you best.
Cheers,
Last edited by pludi; 10-12-2009 at 02:35 AM..
Reason: code tags please...
Hi,
I am new to unix and I need help in solving below mentioned issue, really appreciate ur help.
I have a file
sam, john, 2324, 07142007
tom, thomson, 2343, 07142007
john, scott, 2478, 07142007
its a comma delimited file, I need to extract the last column from each line and this... (4 Replies)
I would like to compare the values of 2nd column of consecutive lines of same file in such a way so that if the difference between first value and second value is more than 100 it should print complete line else ignore line.
Input File
==========
PDB 2500
RTDB 123
RTDB-EAGLE 122
VSCCP 2565... (4 Replies)
- I have two files (File 1 and File 2) and the contents of the files are mentioned below.
- I am trying to compare the values of Column1 of File1 with Column1 of File2. If a match is found, print the corresponding value from Column2 of File1 in Column5 of File2.
- I tried to modify and use... (10 Replies)
Dear Unix experts,
I have got a file where I would like to compare the values of second column if first column is same in such a way that the difference between the values is >50. If not, I would like to discard both values.
For example, my input file looks like -
comp275_c0_seq2 73... (7 Replies)
Input File:-
COLUMN1 COLUMN2 COLUMN3 COLUMN4 COLUMN5 COLUMN6 SMS Email AO Mail Post N Cell
VEGE Potato E W 396 12 0 384 0 0 0 0 0
VEGE Onion S W 17 0 17 0 0 0 0 0 0
FRUIT APPLE N W 549 61 0 0 0 0 0 488 0
FRUIT APPLE SE W 291 14 239 38 0 10 0 0 0
FRUIT APPLE EAMS W 397 32 309 56 309 309 0... (27 Replies)
Hi,
How do I compare two columns within a text file
If 2nd column values are same then I want to know 3rd column number matches or not
Example:
Prod Stag1 1234.79
Prod Stag2 1234.79 20
Prod Stag3 1234.79 30
Prod Stag4 1234.79
UAT Stag1 1243.56
UAT Stag2 1243.56 20
UAT ... (3 Replies)
I'm trying to learn awk, but I've hit a roadblock with this problem. I have a hierarchy stored in a file with 3 columns:
id name parentID
4 D 2
2 B 1
3 C 1
1 A 5
I need to check if there are any values in column 3 that are not represented anywhere in column 1. I've tried this:
awk '{arr;}... (7 Replies)
Discussion started by: kaktus
7 Replies
LEARN ABOUT SUNOS
ldap_compare_ext_s
ldap_compare(3LDAP) LDAP Library Functions ldap_compare(3LDAP)NAME
ldap_compare, ldap_compare_s, ldap_compare_ext, ldap_compare_ext_s - LDAP compare operation
SYNOPSIS
cc[ flag... ] file... -lldap[ library... ]
#include <lber.h>
#include <ldap.h>
int ldap_compare(LDAP *ld, char *dn, char *attr, char *value);
int ldap_compare_s(LDAP *ld, char *dn, char *attr, char *value);
int ldap_compare_ext(LDAP *ld, char *dn, char *attr, struct berval *bvalue, LDAPControl **serverctrls, LDAPControl **clientctrls, int
*msgidp);
int ldap_compare_ext_s(LDAP *ld, char *dn, char *attr, struct berval *bvalue, LDAPControl **serverctrls, LDAPControl **clientctrls);
DESCRIPTION
The ldap_compare_s() function is used to perform an LDAP compare operation synchronously. It takes dn, the DN of the entry upon which to
perform the compare, and attr and value, the attribute type and value to compare to those found in the entry. It returns an LDAP error
code, which will be LDAP_COMPARE_TRUE if the entry contains the attribute value and LDAP_COMPARE_FALSE if it does not. Otherwise, some
error code is returned.
The ldap_compare() function is used to perform an LDAP compare operation asynchronously. It takes the same parameters as ldap_compare_s(),
but returns the message id of the request it initiated. The result of the compare can be obtained by a subsequent call to
ldap_result(3LDAP).
The ldap_compare_ext() function initiates an asynchronous compare operation and returns LDAP_SUCCESS if the request was successfully sent
to the server, or else it returns a LDAP error code if not (see ldap_error(3LDAP). If successful, ldap_compare_ext() places the message
id of the request in *msgidp. A subsequent call to ldap_result(), can be used to obtain the result of the add request.
The ldap_compare_ext_s() function initiates a synchronous compare operation and as such returns the result of the operation itself.
ERRORS
ldap_compare_s() returns an LDAP error code which can be interpreted by calling one of ldap_perror(3LDAP) and friends. ldap_compare()
returns -1 if something went wrong initiating the request. It returns the non-negative message id of the request if it was successful.
ATTRIBUTES
See attributes(5) for a description of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
|Availability |SUNWcsl (32-bit) |
| |SUNWcslx (64-bit) |
|Interface Stability |Evolving |
+-----------------------------+-----------------------------+
SEE ALSO ldap(3LDAP), ldap_error(3LDAP), attributes(5)BUGS
There is no way to compare binary values using ldap_compare().
SunOS 5.10 27 Jan 2002 ldap_compare(3LDAP)