Skip to main content

Questions tagged [shuf]

0 votes
1 answer
1k views

I have two directories, lets call them X and Y Within them I have 100k+ files, .jpg files in X and .txt files in Y I want to randomly select N files from X and copy to folder Z This should be ...
Martin Pedersen's user avatar
4 votes
2 answers
5k views

I'm working in Bash using this nested shuf command to get an alphanumeric string of variable length: shuf -erz -n $(shuf -e -n 1 {0..5}) {A..Z} {a..z} {0..9} Current output: This outputs the ...
LoopedLine's user avatar
0 votes
5 answers
238 views

I'm writing quizzes for my students in a markdown language. One of the quizzes might look like this: % QUESTION Who played drums for The Beatles? (X) Ringo ( ) John ( ) Paul ( ) George % QUESTION ...
Brian Fitzpatrick's user avatar
0 votes
2 answers
471 views

I have this script that extracts 200 random characters from a set: #!/usr/bin/bash n=$(stat -c "%s" newfile.txt) r=$(shuf -i1-"$((n-200+1))" -n1) < newfile.txt tail -c+"$r&...
GSQ's user avatar
  • 37
0 votes
1 answer
371 views

I have this script that extracts 200 random characters from a set: tail -n+2 file.fasta | tr -d '\n' > newfile n=$(stat -c "%s" newfile) r=$(shuf -i1-"$((n-200+1))" -n1) newfile ...
GSQ's user avatar
  • 37
0 votes
1 answer
141 views

For simulation I am trying to do, I want a text file with numbers ranging from 0 to 2^33 which is a huge number. I have used this command: seq 0 Number >> OUTPUT FILE But this is very slow. The ...
Uday's user avatar
  • 101
2 votes
0 answers
287 views

This is similar to Shuffle two parallel text files I have: two large csv files with parallel lines. (they represent 'before' and 'after' states for particular items). The fields are sometimes ...
Tim's user avatar
  • 237
4 votes
4 answers
16k views

I can select a random file using this command find ./ -type f | shuf -n 1 But it's showing the same file some times. Is it possible to stop picking duplicate files? Is there any other utility for ...
Akhil's user avatar
  • 1,400
0 votes
2 answers
655 views

Fairly new to Linux. I have a nixie clock that runs off of a Raspberry Pi. I would like to send a random sequence of six digits to it every so often to help prolong the life of the Nixie tubes. ...
Joey29's user avatar
  • 9
3 votes
1 answer
561 views

I have string save as test="test1 test2 test3 test4 test5 test6" and echo $(shuf -e $test) it gives me the same output as $test, why? I expect the different order of the original string
Tiger's user avatar
  • 377
2 votes
2 answers
2k views

Some GNU coreutils utilities like sort and shuf use a file as what effectively serves a seed. Does the size of the file matter? The recommended way, https://www.gnu.org/software/coreutils/manual/...
flow2k's user avatar
  • 641
0 votes
0 answers
198 views

I have a script, where there is a line: eval for i in \{"$1".."$2"\}\; do [ ! -e "$3"/\$i.\* ] \&\& echo \"\$i\" \; done \| shuf \| mycommand "$3" which means: first create a sequence of ...
Tim's user avatar
  • 107k
3 votes
1 answer
3k views

I have a directory containing nearly 250K files, which are lots of files, and I want to move x random files to another directory. I searched and I got the solution of using the shuf and mv commands ...
Mostafa Hussein's user avatar
0 votes
1 answer
972 views

I have a directory with many files. From each of these files I want a random sample and copy to a new directory with file names same as from which random sample was drawn.
Abhishek Gupta's user avatar
2 votes
2 answers
493 views

I'd like to randomly select a line after a given number of lines. For example here's my input: 8 blue 8 red 8 yellow 8 orange 3 pink 3 white 3 cyan 3 purple 1 magenta 1 black 1 green 1 brown and with ...
mtherk16's user avatar