In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly shows you "how to use the shuf command in Linux". The content is simple and clear. I hope it can help you solve your doubts. Let the editor lead you to study and learn how to use the shuf command in Linux.
The Linux common command shuf command is used to output input lines to standard output in random order.
Syntax format shuf [options]... [file] or: shuf-e [option]. [parameter]. Or: shuf-I LO-HI [option]. Parameter-e,-- echo treats each parameter as input line-I,-- input-range=LO-HI treats each number from LO to HI as input line-n,-- head-count= lines up to output the specified number of lines-o,-- output= file outputs the result to the specified file instead of standard output-- the random-source= file gets random bits-z from the specified file. -- zero-terminated ends line with 0 instead of new line-- help displays this help and exits-- version displays version information and exits if no file is specified Or if the file is "-", it is read from standard input. Example 1
[tank@localhost test1] # cat 1.txt # ordered 1 2 3 4 5 6 [tank@localhost test1] # shuf 1.txt # disordered 6 2 3 5 4 1 cases 2
[root@pf] # shuf-e 1 2 3 4 5 6 1 2 6 4 3 5 [root@pf] # shuf-I 1-6 6 5 4 2 3 1 [root@pf] # shuf-N3-I 1-6 4 51 [root@pf] # shuf-N3-I 1-6-o out.txt [root@pf] # cat out.txt 546 cases 3
Let me share an example of simulating a two-color ball with a shuf command: # define an array of red balls and basketball. # RED= `seq 16` # BLUE= `seq 33` # one ball is randomly selected from the red ball array. # echo "Red Ball:"; echo "${RED [@]}" | shuf-N1 # does not put back and extract 6 balls in the basketball array # echo "Blue Ball:"; echo "${BLUE [@]}" | shuf-n6 is all the contents of the article "how to use the shuf command in Linux". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.