lundi 18 janvier 2016

randomly choose few lines from a file and then choose same line nos from second file

I have 2 files, say A.txt and B.txt, each having 100 lines. I want to choose 10 records randomly from file A (which can easily be done with linux shuf command). But now I want same line nos data from file B also. Is there any easy way to do it via linux command line.

For Example: Following are the records from 2 files,
A1........A100
B1........B100

If 10 random records generated from A are A1, A3, A9, etc, then i want B1, B3, B9, etc from file B.




Aucun commentaire:

Enregistrer un commentaire