"Shell" Shuf command extracts random rows of a file

Source: Internet
Author: User

The Shuf command can randomly extract different lines of a text file, output to a file or standard output.

Shuf usage: Shuf [options] ... [File] or: Shuf-e [Options] ... [Parameters] ... Or: Shuf-I. lo-HI [Options] ... Write a random permutation of the input lines to standard output. If no file is specified, or if the file is"-", it is read from the standard input.  The required parameters are available for both long and long options. -E,--Echotreat each ARG as a input line-I.,--input-range=lo-hi treat each number LO through HI as a input line-N,--Head-count=count output at the most count lines-O,--output=fileWriteresult to FILE instead of the standard output--random-source=file get random bytes from file-R,--repeat output lines can be repeated-Z,--zero-terminated line delimiter are NUL, not newline--Help displays this information and exits--version display version information and exit

Example: Extracting a random 20 row from a Input.txt

 -O output.txt

"Shell" Shuf command extracts random rows of a file

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.