Home > Archive > PERL Miscellaneous > December 2006 > Perl equivalent to the following shell operation.
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Perl equivalent to the following shell operation.
|
|
| grocery_stocker 2006-12-26, 10:03 pm |
| I'm analyzing a really large file. While I was bringing in carts at
work, I figured it would be easier/more efficient just to split the
file, sort it in parallel, then merge it. If I wrote a shell script, I
would do something like the following:
#This code is duped from a google search
(cat list1 list2 list3 | sort | uniq > list123) &
(cat list4 list5 list6 | sort | uniq > list456) &
wait
diff list123 list456
However, I'm writing this in Perl because it would be easier to sort
the file using the Schwartzian Transform method. Is there an equivalent
in Perl or would I have to use some kind of existing Perl mod?
Chad
| |
| grocery_stocker 2006-12-27, 4:03 am |
|
grocery_stocker wrote:
> I'm analyzing a really large file. While I was bringing in carts at
> work, I figured it would be easier/more efficient just to split the
> file, sort it in parallel, then merge it. If I wrote a shell script, I
> would do something like the following:
>
> #This code is duped from a google search
> (cat list1 list2 list3 | sort | uniq > list123) &
> (cat list4 list5 list6 | sort | uniq > list456) &
>
> wait
>
> diff list123 list456
>
> However, I'm writing this in Perl because it would be easier to sort
> the file using the Schwartzian Transform method. Is there an equivalent
> in Perl or would I have to use some kind of existing Perl mod?
>
> Chad
Never mind. I entered the world 'parallel' in the search box thingy and
google magically turned up the answer.
| |
|
|
"grocery_stocker" <cdalten@gmail.com> wrote in message
news:1167196566.656836.31470@f1g2000cwa.googlegroups.com...
>
> grocery_stocker wrote:
>
> Never mind. I entered the world 'parallel' in the search box thingy and
> google magically turned up the answer.
>
I'm not sure why use say it 'would be easier to sort the file using the
Schwartian Transform method'. This method does not make it easier, in fact
it makes the code more complex that simply sorting, but with the advantage
of efficiency where re-calculating values is involved at each comparison.
This would not be the case in the simple sort above.
| |
|
|
"Dave" <daveandniki@ntlworld.com> wrote in message
news:45923841$0$27396$ba4acef3@news.orange.fr...
>
> "grocery_stocker" <cdalten@gmail.com> wrote in message
> news:1167196566.656836.31470@f1g2000cwa.googlegroups.com...
>
> I'm not sure why use say it 'would be easier to sort the file using the
> Schwartian Transform method'. This method does not make it easier, in fact
> it makes the code more complex that simply sorting, but with the advantage
> of efficiency where re-calculating values is involved at each comparison.
> This would not be the case in the simple sort above.
>
>
s/use/you/;
|
|
|
|
|