samedi 19 novembre 2016

Find the results of 'grep -c' without the -c argument and creating an 'alea' file from /dev/random

I think that I've put everything I'd like to do in the title.

For example, ls|grep -c abc prints 793, I'd like to have the same result, without using -c.

Moreover, I'm also trying to put a random byte in a file using /dev/random, and eventually, I'd like to use a command line that could take a random integer between 0 and 256.

Thanks in advance folks, I know that I'm asking a lot, but I've done a lot of the work I'm asked to do, these are the last questions, and I can't figure them out. :(

What I've done so far :

  • For grep -c, I've tried to use grep -n, but it prints twice the results of grep -c, it prints 1363.

  • Concerning the random byte, I thought about using cat, but cat isn't the appropriate tool to manipulate bytes.

  • Finally, due to the fact that I didn't find the way to extract a random byte, I don't know to extract an integer between 0 and 256




Aucun commentaire:

Enregistrer un commentaire