I'd like to insert a random number after specific text using a shell script. I can generate a random number (32 char):
cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 32 | head -n 1
How do I insert this random number (32_char_random_number) after text (e.g. "alphabet" in a file?:
sed '/\balphabet \b/& 32_char_random_number/' file
thanks.
Aucun commentaire:
Enregistrer un commentaire