mercredi 23 octobre 2019

Add a random variable into Sed \a every new lines

i want to add a random number every new lines created by sed

For the moment my command is :

sed 'a path/to/file$(($RANDOM%7))' tmp/line.txt

Result :

line1
path/to/file1
line3
path/to/file1
line5
path/to/file1
line7
path/to/file1
...(22K lines)

Expected :

line1
path/to/file1
line3
path/to/file0
line5
path/to/file7
line7
path/to/file5
...(22k lines)



Aucun commentaire:

Enregistrer un commentaire