I'm doing a hobby project that has me sorting huge files with sort of monotonous keys. It's very slow -- the current file is about 300 GB and has been sorting for a day. I know that sort has this --batch-size and --buffer-size parameters, but I'd like a jump start if possible to limit the number of days I have to fool around finding what works. The man page doesn't even tell me what the default values are.
I have a 4-core 64-bit AMD processor, 32 GB RAM and plenty of hard drive space.
I would normally do a preliminary radix sort on files this size, but it's a bit awkward with these keys. The keys represent positions in a game and consist of 64 bytes of just 3 values: x, o and -, always beginning with x. They tend to form clusters that are similar at the beginning, and vary from run to run. It's not clear how to form the radix. Here are records from various spots in a typical run....
I am trying to understand the webserver log file for an error which has occured on my live web site.
The webserver access file is very big in size so it's not possible to open this file using vi editor. I know the approximate time the error occured, so i am interested in looking for the log file... (4 Replies)
Hi All
I have approximately 10 files that are at least 100+ MB in size. I am importing them into a DB to output them to the web. What i need to do first is clean the files up so i dont have un necessary rows in the DB. Below is what the file looks like:
Ignore the <TAB> annotations as that... (4 Replies)
I was wondering how sort works.
Does file size and time to sort increase geometrically?
I have a 5.3 billion line file I'd like to use with sort -u I'm wondering if that'll take forever because of a geometric expansion?
If it takes 100 hours that's fine but not 100 days.
Thanks so much. (2 Replies)
hello all,
kindly i need your help, i made a script to print a specific lines from a huge file about 3 million line. the output of the script will be about 700,000 line...the problem is the script is too slow...it kept working for 5 days and the output was only 200,000 lines !!!
the script is... (16 Replies)
Hi all,
I have problem with searching hundreds of CSV files, the problem is that search is lasting too long (over 5min).
Csv files are "," delimited, and have 30 fields each line, but I always grep same 4 fields - so is there a way to grep just those 4 fields to speed-up search.
Example:... (11 Replies)
Hello everyone. Need some help copying a filesystem. The situation is this: I have an oracle DB mounted on /u01 and need to copy it to /u02. /u01 is 500 Gb and /u02 is 300 Gb. The size used on /u01 is 187 Gb. This is running on solaris 9 and both filesystems are UFS.
I have tried to do it using:... (14 Replies)
Hello all -
I am to this forum and fairly new in learning unix and finding some difficulty in preparing a small shell script. I am trying to make script to sort all the files given by user as input (either the exact full name of the file or say the files matching the criteria like all files... (3 Replies)
Hello,
I have a very large file of around 2 million records which has the following structure:
I have used the standard awk program to sort:
# wordfreq.awk --- print list of word frequencies
{
# remove punctuation
#gsub(/_]/, "", $0)
for (i = 1; i <= NF; i++)
freq++
}
END {
for (word... (3 Replies)
Discussion started by: gimley
3 Replies
LEARN ABOUT MOJAVE
radixsort
RADIXSORT(3) BSD Library Functions Manual RADIXSORT(3)NAME
radixsort, sradixsort -- radix sort
LIBRARY
Standard C Library (libc, -lc)
SYNOPSIS
#include <limits.h>
#include <stdlib.h>
int
radixsort(const unsigned char **base, int nmemb, const unsigned char *table, unsigned endbyte);
int
sradixsort(const unsigned char **base, int nmemb, const unsigned char *table, unsigned endbyte);
DESCRIPTION
The radixsort() and sradixsort() functions are implementations of radix sort.
These functions sort an array of pointers to byte strings, the initial member of which is referenced by base. The byte strings may contain
any values; the end of each string is denoted by the user-specified value endbyte.
Applications may specify a sort order by providing the table argument. If non-NULL, table must reference an array of UCHAR_MAX + 1 bytes
which contains the sort weight of each possible byte value. The end-of-string byte must have a sort weight of 0 or 255 (for sorting in
reverse order). More than one byte may have the same sort weight. The table argument is useful for applications which wish to sort differ-
ent characters equally, for example, providing a table with the same weights for A-Z as for a-z will result in a case-insensitive sort. If
table is NULL, the contents of the array are sorted in ascending order according to the ASCII order of the byte strings they reference and
endbyte has a sorting weight of 0.
The sradixsort() function is stable, that is, if two elements compare as equal, their order in the sorted array is unchanged. The
sradixsort() function uses additional memory sufficient to hold nmemb pointers.
The radixsort() function is not stable, but uses no additional memory.
These functions are variants of most-significant-byte radix sorting; in particular, see D.E. Knuth's Algorithm R and section 5.2.5, exercise
10. They take linear time relative to the number of bytes in the strings.
RETURN VALUES
The radixsort() function returns the value 0 if successful; otherwise the value -1 is returned and the global variable errno is set to indi-
cate the error.
ERRORS
[EINVAL] The value of the endbyte element of table is not 0 or 255.
Additionally, the sradixsort() function may fail and set errno for any of the errors specified for the library routine malloc(3).
SEE ALSO sort(1), qsort(3)
Knuth, D.E., "Sorting and Searching", The Art of Computer Programming, Vol. 3, pp. 170-178, 1968.
Paige, R., "Three Partition Refinement Algorithms", SIAM J. Comput., No. 6, Vol. 16, 1987.
McIlroy, P., "Computing Systems", Engineering Radix Sort, Vol. 6:1, pp. 5-27, 1993.
HISTORY
The radixsort() function first appeared in 4.4BSD.
BSD January 27, 1994 BSD