09-07-2017
That script would not sort the rows as it was not asked to do.
It would be interesting to see a comparison between the different approaches. Could you time each and post the results?
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
One of our servers runs Solaris 8 and does not have "ls -lh" as a valid command. I wrote the following script to make the ls output easier to read and emulate "ls -lh" functionality. The script works, but it is slow when executed on a directory that contains a large number of files. Can anyone make... (10 Replies)
Discussion started by: shew01
10 Replies
2. Shell Programming and Scripting
hii everyone ,
i have a file in which i have line numbers.. file name is file1.txt
aa bb cc "12" qw
xx yy zz "23" we
bb qw we "123249" jh
here 12,23,123249. is the line number
now according to this line numbers we have to print lines from other file named... (11 Replies)
Discussion started by: kumar_amit
11 Replies
3. Red Hat
Hi,
Can any one help me out in solving the problem i have a linux database server it is tooo slow that i am unable to open even the terminial is there any solution to get rid of this problem.How to make this server faster.
Thanks & Regards
Venky (0 Replies)
Discussion started by: venky_vemuri
0 Replies
4. Shell Programming and Scripting
Hi All,
I have some 80,000 files in a directory which I need to rename. Below is the command which I am currently running and it seems, it is taking fore ever to run this command. This command seems too slow. Is there any way to speed up the command. I have have GNU Parallel installed on my... (6 Replies)
Discussion started by: shoaibjameel123
6 Replies
5. Shell Programming and Scripting
Hi all,
In bash scripting, I use to read files:
cat $file | while read line; do
...
doneHowever, it's a very slow way to read file line by line.
E.g. In a file that has 3 columns, and less than 400 rows, like this:
I run next script:
cat $line | while read line; do ## Reads each... (10 Replies)
Discussion started by: AlbertGM
10 Replies
6. Shell Programming and Scripting
Hi,
I have a script below for extracting xml from a file.
for i in *.txt
do
echo $i
awk '/<.*/ , /.*<\/.*>/' "$i" | tr -d '\n'
echo -ne '\n'
done
.
I read about using multi threading to speed up the script.
I do not know much about it but read it on this forum.
Is it a... (21 Replies)
Discussion started by: chetan.c
21 Replies
7. Shell Programming and Scripting
awk "/May 23, 2012 /,0" /var/tmp/datafile
the above command pulls out information in the datafile. the information it pulls is from the date specified to the end of the file.
now, how can i make this faster if the datafile is huge? even if it wasn't huge, i feel there's a better/faster way to... (8 Replies)
Discussion started by: SkySmart
8 Replies
8. Shell Programming and Scripting
Hi,
I have a large number of input files with two columns of numbers.
For example:
83 1453
99 3255
99 8482
99 7372
83 175
I only wish to retain lines where the numbers fullfil two requirements. E.g:
=83
1000<=<=2000
To do this I use the following... (10 Replies)
Discussion started by: s052866
10 Replies
9. Shell Programming and Scripting
I have script like below, who is picking number from one file and and searching in another file, and printing output.
Bu is is very slow to be run on huge file.can we modify it with awk
#! /bin/ksh
while read line1
do
echo "$line1"
a=`echo $line1`
if
then
echo "$num"
cat file1|nawk... (6 Replies)
Discussion started by: mirwasim
6 Replies
10. Shell Programming and Scripting
I have nginx web server logs with all requests that were made and I'm filtering them by date and time.
Each line has the following structure:
127.0.0.1 - xyz.com GET 123.ts HTTP/1.1 (200) 0.000 s 3182 CoreMedia/1.0.0.15F79 (iPhone; U; CPU OS 11_4 like Mac OS X; pt_br)
These text files are... (21 Replies)
Discussion started by: brenoasrm
21 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)