lundi 27 mars 2017

Extract substrings with certain length randomly from a file with Bash

I have multiple text files, and from each file I need to extract random contiguous substrings with a certain length.

For example, I need to extract Five random substrings that consist of 3 contiguous characters each, or 4 random substrings that consist of 20 characters each.

In practice, let's assume this is the content of one of the files

Welcome to stackoverflow the best technical resource ever

so if I want Five random substrings that consist of 3 characters each, I expect an output that looks like this for example:

elc sta tec res rce

Your help would be much appreciated.




Aucun commentaire:

Enregistrer un commentaire