$type, ref(code): " . ref($code);
+next TEST;
+}
+}
+}
+my $sub = eval "sub { $init (" . join(", ", @code) . ") }";
+ my $sorter = Sort::Key::multi
Hi
I have the following code as an example against a hash of hashes, to sort
by hashrf key
foreach my $opt (sort {uc($options{$b}->{type}) cmp
uc($options{$a}->{type})} keys %options){
my $type=$options{$opt}->{vtype};
$video_type->append_text($type) if defined($type)
On Wed, May 16, 2001 at 10:05:14AM -0700, Matt Noel wrote:
> I have a simple two-dimensional array, call it @Weights. I think of the
> first index as being the Row index and the second being the Column
> index. Normally I'd access an entry thus:
>
> $ItemWeight = $Weights[$row][$col];
>
> I
this is a 2D array, the elements of the
first dimension are references to the second-dimensional sub-arrays.
Thus, @{$a} is the entire sub array, and $a->[0] means "give me element
zero of the array poited to by $a". Paul is sorting the first dimension
elements by the values in the secon
On May 16, Paul said:
>"or" also short circuits, and some consider it more readable, but it
>(and the "and" operator) always return(s) a boolean value, while ||
>(and &&) return the value of the first true expression.
>
> $a or $b # returns 1 if either has a non-false value, else ''
> $a || $b
For a variable number of second-dimension elements, try:
my @sorted = sort { my($ndx,$ret) = (0,0);
while(defined($a->[$ndx]) and defined($b->[$ndx])) {
last if $ret = ($a->[$ndx] <=> $b->[$ndx++]);
}
$ret;
} @Weights;
This keeps comparing elements fro
--- Jeff Pinyan <[EMAIL PROTECTED]> wrote:
> On May 16, Paul said:
>
> >"or" also short circuits, and some consider it more readable, but it
> >(and the "and" operator) always return(s) a boolean value, while ||
> >(and &&) return the value of the first true expression.
> >
> > $a or $b # retur
- Original Message -
From: Matt Noel <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, May 16, 2001 7:05 PM
Subject: Sorting a Two Dimensional Array
(...)> I have a simple two-dimensional array, call it @Weights. I think of
the
> first index as being the
: I would like to sort an array like this
: my @pets = {$cat, $dog,$camel,$camel,$camel,$dog}
: and then to have it printed out in the order of occurrences
: print "I will give you <3> camels, <2> dogs, <1> cat " for the blond one
Well, first of all, what you have there isn't really an array.
Slight correction:
: pushd @petcounts, sprintf "<%d> %s%s",
should be
push @petcounts, sprintf "<%d> %s%s",
-- tdk
Hi Folks!
My problem: I have a file of ids like a.12.34 or z.9.234 and want to sort
it into a new file. As the sort function sorts digit by digit I can't use
it (not so easy). Additionally the data file is quite big (11M) so I don't
know if it is okay to work with such big array.
I hope someone c
Hi Folks!
My problem: I have a file of ids like a.12.34 or z.9.234 and want to sort
it into a new file. As the sort function sorts digit by digit I can't use
it (not so easy). Additionally the data file is quite big (11M) so I don't
know if it is okay to work with such big array.
I hope someone c
I am dumping rows of an array into an excel file. I would like those
rows to be sorted. If I wanted them to be sorted by the first elements
how would I do it?
Code
#!/usr/bin/perl -w
use strict;
use Spreadsheet::WriteExcel;
open IN, ($ARGV[0]);
my @AoA;
while (){
chomp;
push (@AoA,[(split
TED]
Subject: Sorting an Array with classobjects
Hello Perlgurus!
I have made a small program that creates some instances of a classobject and
puts them into an array. I want to sort this array in order of a specific
value in the class.
I was thinking of something like this but it doesn't work
Greetings!
In the train schedule program that you are all probably heartily sick
of by now, I have added a ScheduleDay class that represents all trains
running on a given day. It has a method that returns an array of
references to all of the Train objects for that day. I want to sort
those train
Folks,
I want to sort my masked hashes into neat little piles for easier
digestion:
Please note this is _example_ data 8-)
my $h = {
a => { name => 'apple', taste => 3 },
b => { name => 'peach', taste => 2 },
c => { name => 'banana', taste => 2 },
}
I want to sort first on taste and then
1: 10
2: 15
10: 5
If you want to see the data, then you would need to explain what you want.
Wags ;)
-Original Message-
From: Balint, Jess [mailto:[EMAIL PROTECTED]]
Sent: Monday, November 18, 2002 08:07
To: '[EMAIL PROTECTED]'
Subject: sorting Numeric OR Character data
> If you want to see the data, then you would need to explain
> what you want.
>
Sorry if I was not clear. I would like to know if there is a block
equivalent to { $a <=> $b } AND { $a cmp $b } at the same time. If I use the
cmp style, my numbers get sort asciibetically and if I use the <=> I ca
-
From: Balint, Jess [mailto:[EMAIL PROTECTED]]
Sent: Monday, November 18, 2002 12:38
To: 'Wagner, David --- Senior Programmer Analyst --- WGO'
Cc: '[EMAIL PROTECTED]'
Subject: RE: sorting Numeric OR Character data
> If you want to see the data, then you would need to e
648: 22,bananas,20021118-1648
20021118-1725: 16,apples,20021118-1725
20021118-1921: 4,grapes,20021118-1921
Wags ;)
-Original Message-----
From: Gavin Laking [mailto:[EMAIL PROTECTED]]
Sent: Monday, November 18, 2002 13:53
To: [EMAIL PROTECTED]
Subject: Flatfile database sorting in Perl
Gavin Laking wrote:
>
> One of my scripts uses a home-brewed flatfile database to store
> information, and I've run up against a problem when I wish to sort
> columns of data.
>
> An example of the database file:
> (items,fruit,date)
>
> 16,apples,20021118-1725
> 22,bananas,20021118-1648
> 4,gra
Hello all,
When I populate this hash (%SrcIDs) from "SELECT id, desc, from myTable
order by desc" it doesn't order by the description field "desc". (printing
each row in the while loop show that the SQL is sorted)
while( my($id, $desc) = $sth->fetchrow ) {
$SrcIDs{$id} = $desc;
}
$sth-
WC -Sx- Jones wrote:
> John W. Krahn wrote:
> >>replying) so James can take ownership of those parts of
> >>this thread.
> >
> >
> > Not under most country's copyright laws he can't. :-(
>
> LOL :)
>
> I'd like to see that erroneous verbage - as words,
> expressed as thoughts and ideas in the di
Chris Mortimore wrote:
I want to sort an AoH. Not each hash by its keys, but the array by
the value of one of the keys in each hash.
The value of one of the keys? If you don't know *which* key in
respective hash, this appears to be pretty tricky...
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc
Chris Mortimore wrote:
> I want to sort an AoH. Not each hash by its keys, but the array by
> the value of one of the keys in each hash.
The value of one of the keys? If you don't know *which* key in
respective hash, this appears to be pretty tricky...
--
Gunnar Hjalmarsson
Email: http://www.g
On Thu, 5 Aug 2004, Chris Mortimore wrote:
Gunnar Hjalmarsson wrote:
> Chris Mortimore wrote:
>> I want to sort an AoH. Not each hash by its keys, but the array by
>> the value of one of the keys in each hash.
>
> The value of one of the keys? If you don't know *which* key in
> respective hash, th
-Original Message-
From: Chris Mortimore [mailto:[EMAIL PROTECTED]
Sent: Thursday, August 05, 2004 5:19 PM
To: [EMAIL PROTECTED]
Subject: Sorting an array of hashes
I want to sort an AoH. Not each hash by its keys, but the array by the
value of one of the keys in each hash.
I know how
On 8/5/2004 5:18 PM, Chris Mortimore wrote:
I want to sort an AoH. Not each hash by its keys, but the array by the
value of one of the keys in each hash.
I know how to sort a simple array.
I know how to sort a hash by the keys.
Could someone kindly point me to the documentation on sorting arrays
Chris Mortimore wrote:
Gunnar Hjalmarsson wrote:
Chris Mortimore wrote:
I want to sort an AoH. Not each hash by its keys, but the
array by the value of one of the keys in each hash.
The value of one of the keys? If you don't know *which* key in
respective hash, this appears to be pretty tricky...
-Original Message-
From: Chris Mortimore [mailto:[EMAIL PROTECTED]
Sent: Thursday, August 05, 2004 5:19 PM
To: [EMAIL PROTECTED]
Subject: Sorting an array of hashes
I want to sort an AoH. Not each hash by its keys, but the array by the
value of one of the keys in each hash. I know how
I want to search a directory of log files and populate a list of those log files ONLY
if they match today's date (localtime).
$logs = 'c:\logs\W3SVC1';
opendir LOGS, "$logs" or die "Can't open directory: $!\n";
my @files = grep /\.TXT$/, readdir LOGS;
#Right here, I am wondering if there is a
t acceptable to use db without "use DB_File";
> or if I do use it, can I always count on the automatic
> sorting? The docs seem to say that hashes will come back
> unsorted without a sort routine.
>
>
>
ent: Sunday, February 24, 2002 12:27 PM
Subject: sorting with complicated data structure
> Hi all
>
>I am attempting to sort the following data. But I cannot get it to
work.
> Frankly i am not even sure I am allowed to do this in perl. Nonetheless
I
> hope anyone can give me som
On 27/2/02 17:33, "Steven M. Klass" <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> ok here is the fundamental code
>
> print "\n\n**Summary**\n";
> foreach my $key (keys %runset){
> printf ( "%-20s %-20s\n",$key, $runset{$key});
> }
>
> Now I want to sort this hash for example
> print "\n\n**Summa
ething like that?
Answering my own post..
After reading this, I realized that you where probably talking about sorting
the specific keys.
Since I'm not really that advanced, it gets bloated fast.
My $counter = "0":
print "\n\n**Summary**\n";
foreach my $key (keys %runset){
"Tor Hildrum" <[EMAIL PROTECTED]>
To: "Perl" <[EMAIL PROTECTED]>; "Steven M. Klass" <[EMAIL PROTECTED]>
Sent: Thursday, February 28, 2002 3:01 PM
Subject: Re: Sorting a hash table - Advanced;)
> On 27/2/02 17:33, "Steven M. Klass"
Hello Pat,
You can do it like so:
my %hash;
foreach(sort {$hash{$a} <=> $hash{$b} } keys %hash) {
}
Shawn
- Original Message -
From: "Postman Pat" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, June 24, 2002 1:46 AM
Subj
Shouldn't that be "values %hash" for sorting the values (see below),
also be aware that a hash has no order like an array so you just have to
do what you want while in the foreach loop (or stick them into an
array).
my %hash;
foreach(sort {$hash{$a} <=> $ha
> Shouldn't that be "values %hash" for sorting the values (see below),
> also be aware that a hash has no order like an array so you just have to
> do what you want while in the foreach loop (or stick them into an
> array).
>
> my %hash;
> foreach(sort {$h
>foreach(sort { $hash{$a} <=> $hash{$b} } values %hash) {
> print "$_\n";
>}
Err... This will not work... You will be trying to get a hash value based on the
value...
It's early
my %hash=(thumb='122',tom=>'21',muffit=>'48',miss=>'31');
foreach(sort { $hash{$a} <=> $hash{$b} } values %hash
> -Original Message-
> From: Postman Pat [mailto:[EMAIL PROTECTED]]
> Sent: Monday, June 24, 2002 2:46 AM
> To: [EMAIL PROTECTED]
> Subject: sorting a hash by value.
>
>
> Greetings,
> I would like to sort a hash by value. The hash values are
> numbers. I
For some stupid reason I was imagining that
foreach(sort { $hash{$a} <=> $hash{$b} } keys %hash) {
was going to sort by the keys and not the values, overlooking the
comparison being based on the value, thanks for pointing it out (now I
understand :-)
>>> "Shawn" <[EMAIL PROTECTED]> 06/24/02 10
On Jun 24, Postman Pat said:
>I would like to sort a hash by value. The hash values are numbers. I would
>like to sort this by desceding order. How would I do this? I have searched
>and found nothing on it. I have found lots on sorting by key though...
Where did you search? A sin
Sanilkumar wrote:
>
> Enyone can help me:
>
> how to do Quicksort , selection sort ,mergesort and
> external merge sort in perl that programes are exactly the same way that
> programes in C/C++
This book covers sorting in Perl: http://www.oreilly.
From: sanilkumar <[EMAIL PROTECTED]>
> Enyone can help me:
>
>how to do Quicksort , selection sort ,mergesort and
> external merge sort in perl that programes are exactly the same way
> that programes in C/C++
Well ... exactly the same way you'd do it in C/C++.
The algorithms may be im
$item (@sorted){
print $item->{ID}, "\n";
}
-Original Message-
From: Tomasi, Chuck [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 06, 2002 2:18 PM
To: '[EMAIL PROTECTED]'
Subject: Sorting an array of hashes
Does anyone have any clever ideas
On Wed, 2002-02-06 at 14:17, Tomasi, Chuck wrote:
> Does anyone have any clever ideas for sorting an array of hashes based on
> a key such as an ID number?
>
> Example:
>
> @AoH = (
> { ID => 10101, UserID => 1041, Status => 2 },
> { ID =>
- Original Message -
From: "Tomasi, Chuck" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, February 06, 2002 1:17 PM
Subject: Sorting an array of hashes
> Does anyone have any clever ideas for sorting an array of hashes based on
> a key such a
On Wed, 6 Feb 2002, Tomasi, Chuck wrote:
> Does anyone have any clever ideas for sorting an array of hashes based on
> a key such as an ID number?
>
> Example:
>
> @AoH = (
> { ID => 10101, UserID => 1041, Status => 2 },
> { ID =>
06, 2002 1:28 PM
> To: 'Tomasi, Chuck'; '[EMAIL PROTECTED]'
> Subject: RE: Sorting an array of hashes
>
>
> @sorted = sort {
> $a->{ID} <=> $b->{ID} ## remember that $a and $b
> become the element
> of the array
> ## so if
t array to sort
> print "@unsortiert"; print "\n";
>
> # Print positions of unsorted array (0 to last entry #)
> my @pos_unsortiert = (0..$#unsortiert);
> print "@pos_unsortiert"; print "\n";
>
> # Start sorting
> my @pos_sortiert =
@rob: Thank you for your hints :-)
__
Gesendet von Yahoo! Mail.
Dem pfiffigeren Posteingang.
http://de.overview.mail.yahoo.com
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://lear
; use strict; use warnings; use diagnostics;
> >
> > # Array to sort
> > my @unsortiert = qw(Z A z a 19 91);
> >
> > # Print array to sort
> > print "@unsortiert"; print "\n";
> >
> > # Print positions of unsorted array (0 to last en
with the cmp
operator.
Sorting numbers as strings causes them to be sorted in dictionary
order, which is different from numeric order if the numbers have
the same number of digits. So 2 is greater than 11 in the same way
that 'B'is greater than 'AA'.
That means you want
On 7/2/09 Thu Jul 2, 2009 12:12 PM, "daem0n...@yahoo.com"
scribbled:
>
> Hi,
>
> If I have a loop that for each run creates
>
> while (){
> my $value =~ /^\d/;
> $myhash{$mykey}->{'subkey'} = $value;
> }
>
>
> Normally, if I only want to sort $myhash through it's values, I would do
> s
Hi,
I need an order for hash by user preferences. Because the criterion to order
the hash entries a not numerical and not should sorted alphabetical, I tried
following
3 %hashToSort = (
4 "a" => "one",
5 "b" => "two",
6 "c" => "three",
7 );
@keys = sort { qw(a, b, c) } (
On 9/21/07, sivasakthi <[EMAIL PROTECTED]> wrote:
> open(FILE,:/tmp/test.txt/" or die "cant open the file");
You probably meant a quote mark instead of a colon there.
> foreach $dname (sort {$noofconns{$b} <=> $noofconns{$a}} %noofconns)
It looks as if you want to use the keys() function there,
sivasakthi wrote:
Hi all,
I have file like that following,
site_name access_time
www.google.com14:13:04|14:13:04|
172.16.5.49 14:12:10|14:12:56|
172.16.65.53 14:12:41|14:12:58|
172.16.671.35 14:12:29|
from the above file i n
On 9/21/07, sivasakthi <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I have file like that following,
>
> site_name access_time
> www.google.com14:13:04|14:13:04|
> 172.16.5.49 14:12:10|14:12:56|
> 172.16.65.53 14:12:41|14:12:58|
> 172.16.671.35
sivasakthi wrote:
Hi all,
Hello,
I have file like that following,
site_name access_time
www.google.com14:13:04|14:13:04|
172.16.5.49 14:12:10|14:12:56|
172.16.65.53 14:12:41|14:12:58|
172.16.671.35 14:12:29|
from the abov
sivasakthi schreef:
> Could u help me to solve the pbm???
Try this first:
s/\bu\b/you/
s/\bpbm\b/problem/
s/\?{3}/?/
--
Affijn, Ruud
"Gewoon is een tijger."
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/
On Fri, 2007-09-21 at 12:47 -0400, Chas. Owens wrote:
> On 9/21/07, sivasakthi <[EMAIL PROTECTED]> wrote:
> > Hi all,
> >
> > I have file like that following,
> >
> > site_name access_time
> > www.google.com14:13:04|14:13:04|
> > 172.16.5.49 14:12:10|14:12
[EMAIL PROTECTED] wrote:
> [EMAIL PROTECTED] wrote:
> > I have a rather large group of files (~5000) that I would like to sort
> > into directories by date. Initially by year, then perhaps later by
> > year/month.
> >
> > I'm looking at the -M operator, but it seems like that would requ
Rinku Mahesh wrote:
> Hi,
>
> I've two arrays of same depth (let it be 6)
>
> 1st Array:- @unique {11 , 23, 44, 66, 900, 1009} 2nd Array:- @occ_count {2,
> 77, 22, 2, 77,29}
>
> Here I'm looking for a sorting mechanism with the following conditions:-
>
&g
Mahesh <[EMAIL PROTECTED]> wrote:
Hi,
I've two arrays of same depth (let it be 6)
1st Array:- @unique {11 , 23, 44, 66, 900, 1009}
2nd Array:- @occ_count {2, 77, 22, 2, 77,29}
Here I'm looking for a sorting mechanism with the following conditions:-
a. Sort 2nd Array in desce
s of elements of 2nd array such that sorting the 1st
> array should reflect {23,900,1009,44,11,66}
Why then are these values not stored in an AoA? (see perldsc)
my @x =
( [ 11, 2]
, [ 23, 77]
, [ 44, 22]
, [ 66, 2]
, [ 900, 77]
, [1009, 29]
)
--- Rob Coops <[EMAIL PROTECTED]> wrote:
> Hi Rinku,
>
> Now I could try and explain this in my own words but I think this
> will help you a lot more.
>
> http://www.unix.org.ua/orelly/perl/advprog/ch02_02.htm
>
> What you are looking for is a very common thing, your not the first
> to bump int
Rinku Mahesh <mailto:[EMAIL PROTECTED]> wrote:
: If the above explaination is confusing I'm looking for a way
: where every element of an array can be mapped to corresponding
: element of another array and as a whole both the arrays require
: a sorting w.r.t. 2nd array.
M.J. Do
On Tue, December 12, 2006 6:25 am, Ovid wrote:
> --- Rob Coops <[EMAIL PROTECTED]> wrote:
>
>> Hi Rinku,
>> Now I could try and explain this in my own words but I think this will
help you a lot more.
>>
>> What you are looking for is a very common thing, your not the first to
bump into this problem
On 12/12/2006 04:00 AM, Rinku Mahesh wrote:
Hi,
I've two arrays of same depth (let it be 6)
1st Array:- @unique {11 , 23, 44, 66, 900, 1009}
2nd Array:- @occ_count {2, 77, 22, 2, 77,29}
Here I'm looking for a sorting mechanism with the following conditions
Hardly Armchair wrote:
> Hello List,
Hello,
> I have a data structure containing a bunch of strings in different groups:
>
> $groups = [
> [
> 'SSPDQR',
> 'SSPSDR',
> 'STSSER',
> ],
> [
> 'CSANLH',
>
On 03/13/2007 07:44 PM, Hardly Armchair wrote:
Hello List,
I have a data structure containing a bunch of strings in different groups:
[...]
I want these sorted first alphabetically within the group, and then
according to the number of member in the group.
[...]
This is slightly more compact
alphabetically within the group, and then
>> according to the number of member in the group.
>> [...]
"Mumia> This is slightly more compact way to do it:
"Mumia> @s_groups = map { [ sort { $a cmp $b } @$_ ]; } @$groups;
Uh,
sort { $a cmp $b } @input
is jus
Hi,
I have a list containing the names of all items in a directory. I want
to sort it by non-directories first and then directories, with a
secondary sort in alphabetical order.
I currently have:
my @items = sort {
my $a_path = $args->{direc
I'm stumped on how to sort an array based on a hash refrences's key in
each element of my array.
this is dumbed down code of what I have:
my @array;
while(my $row = $sth->fetchrow_arrayref){
my %hash = (id => $row->[0], name => $row->[1]);
push(@array, \%hash);
}
after the while loop, I'm tryin
On Tue, Aug 09, 2005 at 06:03:18AM -0400, Jeremy Kister wrote:
> I've got an array full of hashrefs:
> my @a = ( {N => '10.1.2.1'},
> {N => '10.1.9.1'},
> {N => '10.3.5.1'},
> {N => '10.1.1.3'},
> );
>
> I want to sort this array, and print. I expect the ou
On 8/9/2005 6:26 AM, Paul Johnson wrote:
> my @s = map { $_ -> [0] }
> sort { $a->[0] <=> $b->[0] ||
>$a->[1] <=> $b->[1] ||
>$a->[2] <=> $b->[2] ||
>$a->[3] <=> $b->[3] }
> map { [ $_, split /\./ ] }
> map { $_->{N} } @a;
On Tue, Aug 09, 2005 at 06:53:33AM -0400, Jeremy Kister wrote:
> On 8/9/2005 6:26 AM, Paul Johnson wrote:
> > my @s = map { $_ -> [0] }
> > sort { $a->[0] <=> $b->[0] ||
> >$a->[1] <=> $b->[1] ||
> >$a->[2] <=> $b->[2] ||
> >$a->[3] <=> $b->
Jeremy Kister wrote:
> On 8/9/2005 6:26 AM, Paul Johnson wrote:
>>my @s = map { $_ -> [0] }
>>sort { $a->[0] <=> $b->[0] ||
>> $a->[1] <=> $b->[1] ||
>> $a->[2] <=> $b->[2] ||
>> $a->[3] <=> $b->[3] }
>>map { [ $_, split /\./ ] }
>>
On 8/9/2005 8:43 AM, John W. Krahn wrote:
> Jeremy Kister wrote:
>>I've apparently dumbed down my code and question a bit too much: I have
>>multiple hashrefs in each element of the array, and I need the resulting
>>sorted array to contain all the data in the original array, simply
>>sorted by the
On Aug 9, Jeremy Kister said:
my @s = map $_->[ 1 ],
sort { $a->[ 0 ] cmp $b->[ 0 ] }
map [ inet_aton( $_->{ N } ), $_ ],
@a;
Now to analyze WTF we're doing here :)
Paul's answer had a slight typo in it -- he was comparing $a->[0],
$a->[1], $a->[2], and $a->[3], wh
On Tue, Aug 09, 2005 at 05:00:44PM -0400, Jeff 'japhy' Pinyan wrote:
> On Aug 9, Jeremy Kister said:
>
> >>my @s = map $_->[ 1 ],
> >>sort { $a->[ 0 ] cmp $b->[ 0 ] }
> >>map [ inet_aton( $_->{ N } ), $_ ],
> >>@a;
> >
> >Now to analyze WTF we're doing here :)
>
> Paul'
Scott Palmer wrote:
> I am attempting to sort by a field in a hash within a hash and I am
> having a hard time finding the right direction. I want the print out
> to sort from smallest to largest in size. Any help would be greatly
> appreciated.
>
> Scott
>
> -
Scott Palmer wrote:
> I am attempting to sort by a field in a hash within a hash and I am
> having a hard time finding the right direction. I want the print out to
> sort from smallest to largest in size. Any help would be greatly
> appreciated.
>
> --
> #!
On 11-08-07 11:28 AM, Ramprasad Prasad wrote:
I have a file that contains records of customer interaction
The first column of the file is the batch number(INT) , and other columns
are date time , close time etc etc
I have to sort the entire file in order of the first column .. but the
problem is
On 11-08-07 11:46 AM, Ramprasad Prasad wrote:
I used a mysql database , but the order by clause used to hang the
process indefinitely
If I sort files in smaller chunks how can I merge them back ??
Please use "Reply All" when responding to a message on this list.
You need two temporary files a
On 7 August 2011 21:24, Shawn H Corey wrote:
> On 11-08-07 11:46 AM, Ramprasad Prasad wrote:
>
>> I used a mysql database , but the order by clause used to hang the
>> process indefinitely
>> If I sort files in smaller chunks how can I merge them back ??
>>
>>
> Please use "Reply All" when respon
On 2011-08-07 17:28, Ramprasad Prasad wrote:
I have a file that contains records of customer interaction
The first column of the file is the batch number(INT) , and other columns
are date time , close time etc etc
I have to sort the entire file in order of the first column .. but the
problem is
print $}' > tmp-file
sort
for id in `cat `;do grep $id >>
sorted-large-file;done
From: Ramprasad Prasad
To: Shawn H Corey
Cc: Perl Beginners
Sent: Sunday, August 7, 2011 11:01 AM
Subject: Re: Sorting an extremely LARGE file
On 7 August 2011 21:24, Shawn H Corey wrote:
>
On Sun, Aug 07, 2011 at 08:58:14PM +0530, Ramprasad Prasad wrote:
> I have a file that contains records of customer interaction
> The first column of the file is the batch number(INT) , and other columns
> are date time , close time etc etc
>
> I have to sort the entire file in order of the first
On Aug 7, 2011 1:15 PM, "Paul Johnson" wrote:
>
> On Sun, Aug 07, 2011 at 08:58:14PM +0530, Ramprasad Prasad wrote:
>
> > I have a file that contains records of customer interaction
> > The first column of the file is the batch number(INT) , and other
columns
> > are date time , close time etc etc
On 11-08-07 03:20 PM, shawn wilson wrote:
It can be sped up (slightly) with an index.
Indexes in SQL don't normally speed up sorting. What they're best at is
selecting a limited number of records, usually less than 10% of the
total. Otherwise, they just get in the way.
The be
On 07/08/2011 20:30, Shawn H Corey wrote:
On 11-08-07 03:20 PM, shawn wilson wrote:
It can be sped up (slightly) with an index.
Indexes in SQL don't normally speed up sorting. What they're best at is
selecting a limited number of records, usually less than 10% of the
total. Other
On Sun, Aug 7, 2011 at 15:58, Rob Dixon wrote:
> On 07/08/2011 20:30, Shawn H Corey wrote:
>>
>> On 11-08-07 03:20 PM, shawn wilson wrote:
>>>
>>> It can be sped up (slightly) with an index.
>>
>> Indexes in SQL don't normally speed up sorti
> "RP" == Rajeev Prasad writes:
RP> hi, you can try this: first get only that field (sed/awk/perl)
RP> whihc you want to sort on in a file. sort that file which i assume
RP> would be lot less in size then your current file/table. then run a
RP> loop on the main file using sorted file
Using the system linux sort ... Does not help.
On my dual quad core machine , (8 gb ram) sort -n file takes 10
minutes and in the end produces no output.
when I put this data in mysql , there is an index on the order by
field ... But I guess keys don't help when you are selecting the
entire table.
On Sun, Aug 7, 2011 at 22:10, Ramprasad Prasad wrote:
>
[snip]
> I guess there is a serious need for re-architecting , rather than
> create such monstrous files, but when people work with legacy systems
> which worked fine when there was lower usage and now you tell then you
> need a overhaul be
On Mon, Aug 08, 2011 at 10:40:12AM +0530, Ramprasad Prasad wrote:
> Using the system linux sort ... Does not help.
> On my dual quad core machine , (8 gb ram) sort -n file takes 10
> minutes and in the end produces no output.
Did you set any other options?
At a minimum you should set -T to tell
On Aug 8, 2011 12:11 AM, "Ramprasad Prasad" wrote:
>
> Using the system linux sort ... Does not help.
> On my dual quad core machine , (8 gb ram) sort -n file takes 10
> minutes and in the end produces no output.
>
I had a smaller file and 32g to play with on a dual quad core (dl320). Sort
just c
On Mon, Aug 08, 2011 at 09:25:48AM -0400, shawn wilson wrote:
> On Aug 8, 2011 12:11 AM, "Ramprasad Prasad" wrote:
> >
> > Using the system linux sort ... Does not help.
> > On my dual quad core machine , (8 gb ram) sort -n file takes 10
> > minutes and in the end produces no output.
>
> I had a
401 - 500 of 702 matches
Mail list logo