Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

shuf(1) [linux man page]

SHUF(1) 							   User Commands							   SHUF(1)

NAME
shuf - generate random permutations SYNOPSIS
shuf [OPTION]... [FILE] shuf -e [OPTION]... [ARG]... shuf -i LO-HI [OPTION]... DESCRIPTION
Write a random permutation of the input lines to standard output. Mandatory arguments to long options are mandatory for short options too. -e, --echo treat each ARG as an input line -i, --input-range=LO-HI treat each number LO through HI as an input line -n, --head-count=COUNT output at most COUNT lines -o, --output=FILE write result to FILE instead of standard output --random-source=FILE get random bytes from FILE -z, --zero-terminated end lines with 0 byte, not newline --help display this help and exit --version output version information and exit With no FILE, or when FILE is -, read standard input. AUTHOR
Written by Paul Eggert. REPORTING BUGS
Report shuf bugs to bug-coreutils@gnu.org GNU coreutils home page: <http://www.gnu.org/software/coreutils/> General help using GNU software: <http://www.gnu.org/gethelp/> Report shuf translation bugs to <http://translationproject.org/team/> COPYRIGHT
Copyright (C) 2010 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. SEE ALSO
The full documentation for shuf is maintained as a Texinfo manual. If the info and shuf programs are properly installed at your site, the command info coreutils 'shuf invocation' should give you access to the complete manual. GNU coreutils 8.5 February 2011 SHUF(1)

Check Out this Related Man Page

SHUF(1) 							   User Commands							   SHUF(1)

NAME
shuf - generate random permutations SYNOPSIS
shuf [OPTION]... [FILE] shuf -e [OPTION]... [ARG]... shuf -i LO-HI [OPTION]... DESCRIPTION
Write a random permutation of the input lines to standard output. With no FILE, or when FILE is -, read standard input. Mandatory arguments to long options are mandatory for short options too. -e, --echo treat each ARG as an input line -i, --input-range=LO-HI treat each number LO through HI as an input line -n, --head-count=COUNT output at most COUNT lines -o, --output=FILE write result to FILE instead of standard output --random-source=FILE get random bytes from FILE -r, --repeat output lines can be repeated -z, --zero-terminated line delimiter is NUL, not newline --help display this help and exit --version output version information and exit AUTHOR
Written by Paul Eggert. REPORTING BUGS
GNU coreutils online help: <http://www.gnu.org/software/coreutils/> Report shuf translation bugs to <http://translationproject.org/team/> COPYRIGHT
Copyright (C) 2017 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. SEE ALSO
Full documentation at: <http://www.gnu.org/software/coreutils/shuf> or available locally via: info '(coreutils) shuf invocation' GNU coreutils 8.28 January 2018 SHUF(1)
Man Page

8 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Problem with sort-of array in SH

Hello to everyone! I'm really new in shell scripting and I'm experiencing a very odd problem. This is my first post in this forum, hope you can help! I know that declaring arrays in Bourne Shell is impossible. But this is where I start having problems - system administrator did not install... (8 Replies)
Discussion started by: onstock
8 Replies

2. Shell Programming and Scripting

If file exists count lines

Hello, Currently I have: FILE=/home/file.txt if ; then echo "File $FILE exists" else echo "File $FILE does not exist" fi exit I would like to make it such that if the file *does* exist, it performs a wc -l count of the file and then if the count is greater than 3 performs... (3 Replies)
Discussion started by: holyearth
3 Replies

3. Shell Programming and Scripting

Adding new line character

Hi All, i am taking end of records using tail command got the out is "END OF FILE. ROW COUNT: 10" and record count in the file is 3. while append the both data into test2.txt file,it's append like END OF FILE. ROW COUNT: 108 my output should be in the test2.txt file END OF FILE. ROW... (9 Replies)
Discussion started by: bmk
9 Replies

4. Shell Programming and Scripting

Using and passing arguments to shuf within awk

Hello all, I would like to output a random number within a range for every line using awk and shuf. I think I'm almost there, but I don't know how to pass arguments to shuf within my awk script: Input 1 12190 12227 1 12595 12721 1 13403 13639 1 14362 14829 1 14970 15038 awk: awk '{... (2 Replies)
Discussion started by: DerSeb
2 Replies

5. UNIX for Dummies Questions & Answers

Reshuffle values in a column

Hi, I would like to know how can I reshuffle values in a column from a text file. I know that shuf command does the trick of reshuffling values but how to substitute lets say the original values of column 9 of a text file by the reshuffling values? Thanks in advance (5 Replies)
Discussion started by: fadista
5 Replies

6. Shell Programming and Scripting

Failure using regex with awk in 'while read file' loop

I have a file1.txt with several 100k lines, each of which has a column 9 containing one of 60 "label" identifiers. Using an labels.txt file containing a list of labels, I'd like to extract 200 random lines from file1.txt for each of the labels in index.txt. Using a contrived mini-example: $ cat... (8 Replies)
Discussion started by: pathunkathunk
8 Replies

7. Shell Programming and Scripting

How to select lines randomly without replacement in UNIX?

Dear Folks I have one column of 15000 lines and want to select randomly 5000 of them in five different times without replacement. I am aware that command 'shuf' and 'sort -R' could select randomly those lines but I am not sure how could I avoid the replacement of selection line. Does anyone have... (10 Replies)
Discussion started by: sajmar
10 Replies

8. UNIX for Beginners Questions & Answers

Cherry picking with sed?

#!/bin/bash shuffle() { Deck=$(shuf -e {2,3,4,5,6,7,8,9,T,J,Q,K,A}{H,S,D,C}) } PH=(6H 9S KC) # playerhand CH=(JD 4D) # computerhand AC=2S # activecard shuffle echo $Deck I am unsure about how to proceed. I want to reshuffle a deck but without the cards in... (3 Replies)
Discussion started by: cogiz
3 Replies