Skip to content

Instantly share code, notes, and snippets.

@shayelkin
Created October 29, 2013 10:05
Show Gist options
  • Save shayelkin/7211895 to your computer and use it in GitHub Desktop.
Save shayelkin/7211895 to your computer and use it in GitHub Desktop.
Outputs N random lines from stdin.
#!/bin/sh
#
# Outputs $1 random lines from stdin.
# Sample usage: cat src_file | sort -R | head -n 100
sort -R | head -n $1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment