Skip to Content
gnux

-n, --head-count

Output at most COUNT lines.

An option of shufx.

Usage

shufx -n COUNT [FILE]
shufx --head-count=COUNT [FILE]

Details

ShortLongValueDefaultMeaning
-n--head-countCOUNToutput at most COUNT lines

Examples

Pick three random lines

shufx -n 3 names.txt

Pick one of several words

shufx -e -n 1 red green blue

Roll a die five times (numbers may repeat)

shufx -i 1-6 -r -n 5

Pick a random file from a NUL-separated list

find . -type f -print0 | shufx -z -n 1

Sample 100 lines for a quick look at a large log

shufx -n 100 access.log > sample.log

Shuffle in the portable gnux shell

gnux shell -c 'lsx -1 | shufx -n 2'

Help in the terminal

gnux help shufx --head-count

On this page