Hi, this is about sorting a very large file (like 10 gb) to keep lines with unique entries across SOME of the columns.
The line originally looked like this:
please note the -u flag.
The problem is that this single command is taking more than 12 hours with 10 g of memory and I am looking for a way to speed things up.
I have heard that splitting a large file into subfiles, then sorting each subfile and then merging back together with the sort command can work, but I am imaging this will not work because I'm using the -u flag to keep only unique rows.
maybe split and then sort first WITHOUT the -u flag and then sort -m -u -k2,2 -k3,3n -k4,4n -k5,5n -k6,6n subfiles ?
I'm thinking of ways to test that, but please let me know if you have any ideas for me!
Thank you kindly.
Jonathan
Last edited by radoulov; 08-31-2011 at 06:01 PM..
Reason: Please use code tags for code and data samples, thank you
Hi,
May I know, if a pipe separated File is large, what is the best method to calculate the unique row count of 3rd column and get a list of unique value of the 3rdcolum?
Thanks in advance! (20 Replies)
This may sound like a trivial problem, but I still need some help:
I have a file with ids and I want to split it 'n' ways (could be any number) into files:
1
1
1
2
2
3
3
4
5
5
Let's assume 'n' is 3, and we cannot have the same id in two different partitions. So the partitions may... (8 Replies)
Input file
---------
12:name1:|host1|host1|host2|host1
13:name2:|host1|host1|host2|host3
14:name3:
......
Required output
---------------
12:name1:host1(2)|host1(1)
13:name2:host1(2)|host2(1)|host3(1)
14:name3:
where (x) - Count how many times field appears in last column
... (3 Replies)
Hi. I am not sure the title gives an optimal description of what I want to do.
I have several text files that contain data in many columns. All the files are organized the same way, but the data in the columns might differ. I want to count the number of times data occur in specific columns,... (0 Replies)
I would like to print unique lines without sort or unique. Unfortunately the server I am working on does not have sort or unique. I have not been able to contact the administrator of the server to ask him to add it for several weeks. (7 Replies)
Hi,
I have an input file that I have sorted in a previous stage by $1 and $4. I now need something that will take the first record from each group of data based on the key being $1
Input file
1000AAA|"ZZZ"|"Date"|"1"|"Y"|"ABC"|""|AA
1000AAA|"ZZZ"|"Date"|"2"|"Y"|"ABC"|""|AA... (2 Replies)
Dear community, I am facing a problem and I kindly ask your help:
I have 4 different data sets consisted from 3 different types of array.
On each file, column 1 is chromosome position, column 2 is SNP id etc... Lets say I have the following (bim) datasets:
x2014:
1 rs3094315... (4 Replies)
Discussion started by: fondan
4 Replies
LEARN ABOUT SUNOS
ldap_sort_strcasecmp
ldap_sort(3LDAP) LDAP Library Functions ldap_sort(3LDAP)NAME
ldap_sort, ldap_sort_entries, ldap_sort_values, ldap_sort_strcasecmp - LDAP entry sorting functions
SYNOPSIS
cc[ flag... ] file... -lldap[ library... ]
#include <lber.h>
#include <ldap.h>
ldap_sort_entries(LDAP *ld, LDAPMessage **chain, char *attr, int (*cmp)());
ldap_sort_values(LDAP *ld, char **vals, int (*cmp)());
ldap_sort_strcasecmp(char *a, char *b);
DESCRIPTION
These functions are used to sort lists of entries and values retrieved from an LDAP server. ldap_sort_entries() is used to sort a chain of
entries retrieved from an LDAP search call either by DN or by some arbitrary attribute in the entries. It takes ld, the LDAP structure,
which is only used for error reporting,
chain, the list of entries as returned by ldap_search_s(3LDAP) or ldap_result(3LDAP). attr is the attribute to use as a key in the sort or
NULL to sort by DN, and cmp is the comparison function to use when comparing values (or individual DN components if sorting by DN). In
this case,
cmp should be a function taking two single values of the attr to sort by, and returning a value less than zero, equal to zero, or greater
than zero, depending on whether the first argument is less than, equal to, or greater than the second argument. The convention is the same
as used by qsort(3C), which is called to do the actual sorting.
ldap_sort_values() is used to sort an array of values from an entry, as returned by ldap_get_values(3LDAP). It takes the LDAP connection
structure ld, the array of values to sort vals, and cmp, the comparison function to use during the sort. Note that cmp will be passed a
pointer to each element in the vals array, so if you pass the normal char ** for this parameter, cmp should take two char **'s as arguments
(that is, you cannot pass strcasecmp or its friends for cmp). You can, however, pass the function ldap_sort_strcasecmp() for this pur-
pose.
For example:
LDAP *ld;
LDAPMessage *res;
/* ... call to ldap_search_s(), fill in res, retrieve sn attr ... */
/* now sort the entries on surname attribute */
if ( ldap_sort_entries( ld, &res, "sn", ldap_sort_strcasecmp ) != 0 )
ldap_perror( ld, "ldap_sort_entries" );
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_search(3LDAP), ldap_result(3LDAP), qsort(3C), attributes(5)NOTES
The ldap_sort_entries() function applies the comparison function to each value of the attribute in the array as returned by a call to
ldap_get_values(3LDAP), until a mismatch is found. This works fine for single-valued attributes, but may produce unexpected results for
multi-valued attributes. When sorting by DN, the comparison function is applied to an exploded version of the DN, without types. The return
values for all of these functions are declared in the <ldap.h> header file. Some functions may allocate memory which must be freed by the
calling application.
SunOS 5.10 27 Jan 2002 ldap_sort(3LDAP)