Skip to content

Instantly share code, notes, and snippets.

@crazyhottommy
Last active August 29, 2015 14:17
Show Gist options
  • Save crazyhottommy/cd02742611c9707290be to your computer and use it in GitHub Desktop.
Save crazyhottommy/cd02742611c9707290be to your computer and use it in GitHub Desktop.
# creat a test file
$time seq 1 10000000 > ten_million.txt
seq 1 10000000 > ten_million.txt 3.51s user 0.13s system 99% cpu 3.663 total
# it is a "big" file with size of 109M
$ls -lh ten_million.txt
-rw-r--r-- 1 Tammy staff 109M Mar 22 20:49 ten_million.txt
$man gshuf
# randomly select 1000 lines from it
$time gshuf -n 1000 ten_million.txt > /dev/null
gshuf -n 1000 ten_million.txt > /dev/null 0.79s user 0.03s system 96% cpu 0.853 total
# after git clone the fast_sample, make a soft link of the executable to /usr/local/bin
# so that I can invoke it anywhere
git clone https://github.com/earino/fast_sample
ln -s /Users/Tammy/github_repos/fast_sample/fast_sample /usr/local/bin
$time fast_sample -n 1000 ten_million.txt > /dev/null
fast_sample -n 1000 ten_million.txt > /dev/null 4.70s user 0.04s system 99% cpu 4.770 total
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment