Skip to content

Instantly share code, notes, and snippets.

@liuweiathust
Created August 26, 2014 06:39
Show Gist options
  • Save liuweiathust/05cf250c9d546c3c4de8 to your computer and use it in GitHub Desktop.
Save liuweiathust/05cf250c9d546c3c4de8 to your computer and use it in GitHub Desktop.
#!/bin/bash
usage ()
{
echo Parallel sort
echo usage: psort file1 file2
echo Sorts text file file1 and stores the output in file2
}
# test if we have two arguments on the command line
if [ $# != 2 ]
then
usage
exit
fi
pv $1 | parallel --pipe --files sort -S512M | parallel -Xj1 sort -S1024M -m {} ';' rm {} > $2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment