Very nice Bozi. I didn't know about the 'uniq' utility. This really helps.
To simplify things a bit, you don't need the 'grep -v' when you use the '-q' option. And adding a second '-q' would also suppress warnings, making it unnecessary to redirect stderr. So your command becomes: