Sponsored Content
Top Forums Shell Programming and Scripting randomly shuffle two text files the same way Post 302551835 by adrunknarwhal on Wednesday 31st of August 2011 08:06:52 PM
Old 08-31-2011
randomly shuffle two text files the same way

What I have are two text files that I need to shuffle randomly, but I need the two files to be randomly shuffled the same way. I have heard of shuf but I do not know how to use it for two files. Maybe there is also an easy/simple awk command I do not know about that could handle this problem.

for example:
before shuffling
Code:
file 1:
one
two
three
four
five



file 2:
1
2
3
4
5

and after shuffling

Code:
file 1:
five
one
four
three
two


file 2:
5
1
4
3
2

As you can see the lines still match up across the two files (ofcourse this is just an example, I need the output to be random).

Last edited by adrunknarwhal; 08-31-2011 at 09:11 PM.. Reason: forgot to add something
 

8 More Discussions You Might Find Interesting

1. AIX

Randomly appearing control characters in text files

Hi, From some time, we have noticed that our ascii files have started corrupting due to the presence of some random control characters (^@, ^M, ^H, ^D). The characters appear randomly on any file after the process that creates the file finishes. If we rerun the process, the files re creates... (0 Replies)
Discussion started by: aakashahuja
0 Replies

2. UNIX for Dummies Questions & Answers

randomly renaming files

I have a directory of files that look like filename 001.ext, filename 002.ext, etc. I'd like to rename the files with unique random numbered names, so that the original filenames are stripped and the files are given a new, random number name. I'm not super new to UNIX, but I don't often use it for... (2 Replies)
Discussion started by: platz
2 Replies

3. Shell Programming and Scripting

shuffle pack of words in line

hello i just seeking for a simple way to make a shuffle by block of words in a line. no matter shell (sh/bash) or perl should be like this: the message (which is line of some file) splits to packs (packs are random 5-10 words in each) then making a new line inserting those packs in a random... (9 Replies)
Discussion started by: tip78
9 Replies

4. UNIX for Dummies Questions & Answers

How to randomly select lines from a text file

I have a text file with 1000 lines, I want to randomly select 200 lines from it and print them as output. How do I go about doing that? Thanks! (7 Replies)
Discussion started by: evelibertine
7 Replies

5. Shell Programming and Scripting

Randomly selecting sequences and generating specific output files

I have two files containing hundreds of different sequences with the same Identifiers (ID-001, ID-002, etc.,), something like this: Infile1: ID-001 ATGGGAGCGGGGGCGTCTGCCTTGAGGGGAGAGAAGCTAGATACA ID-002 ATGGGAGCGGGGGCGTCTGTTTTGAGGGGAGAGAAGCTAGATACA ID-003... (18 Replies)
Discussion started by: Xterra
18 Replies

6. Shell Programming and Scripting

How to shuffle odd and even columns?

Is there any way to place each even column name infront of its odd column using awk or others? input Ab name MGH26 B04 MGH26 B05 output name_Ab B04_MGH26 B05_MGH26 (4 Replies)
Discussion started by: quincyjones
4 Replies

7. Shell Programming and Scripting

Randomized shuffle words on each line

Hi Folks, I have a text file with a thousand lines consisting of words or a group of words separated by commas. I would like to randomize / shuffle the words on each line. Eg; file.txt Linux,Open,Free,Awesome,Best Things in Life,The Greatest Laptop,PC,Tablet,Home Computers,Digital... (2 Replies)
Discussion started by: martinsmith
2 Replies

8. UNIX for Beginners Questions & Answers

Logic shuffle

Hi, Is there any way I can shuffle the numbers randomly. I have been trying to google and I found lots of 'generator' but is it possible to find the background logic to create randomness? Thanks, (3 Replies)
Discussion started by: Indra2011
3 Replies
mpc123(1)						      General Commands Manual							 mpc123(1)

NAME
mpc123 - your handy Musepack audio player SYNOPSIS
mpc123 [options] file(s) DESCRIPTION
mpc123 is a command-line player for the Musepack audio compression format. mpc123 reads mpc audio files and decodes them to the devices specified on the command line. During playback, you can pass to the next playlist element (or a random one if one of the -z and -Z options were used, see below) by send- ing SIGINT to the process, thus usually pressing ^C will act as a "next-button" for the player. OPTIONS
--gain N, -g N Set gain (audio volume) to N (0-100 inclusive, default 100, 0 mutes sound) -o driver Set output devicetype to driver; possible drivers include: oss Linux Open Sound System alsa Advanced Linux Sound Architecture alsa09 ALSA version 0.9 and newer (you should really be using this) esd Enlightenment sound daemon arts Analog Real Time System (kde sound daemon) null Debugging output target --audiodevice dev, -a dev Use dev for audio-out; If not specified, the program tries to pick some sane defaults, based on the used audio output driver. Common devices include: /dev/dsp or /dev/dsp1 for oss output default or hw:0 for alsa09 output --au filename.au, -u filename.au Use au file filename.au for output --cdr filename.cdr, -c filename.cdr Use raw file filename.cdr for output (this can be used directly with cdrecord's -audio option) --wav filename.wav, -w filename.wav Use wave file filename.wav for output --list file, -@ file Use playlist file as list of Musepack files; The playlist format is simple: one file per line. You can easily generate a playlist for mpc123 with the find(1) command: find /path/to/musicroot -iname *.mpc -fprint file --random, -Z Play files randomly until interrupted --shuffle, -z Shuffle list of files before playing --verbose, -v Increase verbosity (default verbosity is 0), the more -v, the more verbose mpc123 becomes --quiet, -q Reset verbosity to 0 (no title or boilerplate); this is the default --help, -h Print the help screen, with some brief usage information AUTHOR
This manual page was written by Daniele Sempione <scrows at oziosi.org>; Fernando Vezzosi <fvezzosi at masobit.net> made some edits January 2006 mpc123(1)
All times are GMT -4. The time now is 01:33 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy