Hello, I'm writing a script and I need to create a loop that will execute same commands until file does contain a specified number of duplicate entries. For example, with each loop I will echo random string to file results
. And I want loop to stop when there are 10 lines of of the same string.
I thought of something like
while [ `some command here (maybe using uniq)` -lt 10 ]
do
command1
command2
command3
done
Do you have any idea how can this problem be solved? Using grep can't be done since I don't know what string I need to look for.
Thank you for your suggestions.