sed - How can I emulate `uniq -d` in awk? -


i've got busybox system doesn't have uniq , i'd generate unique list of duplicated lines.

a plain uniq emulated in awk be:

sort <filename> | awk '!($0 in a){a[$0]; print}' 

how can use awk (or sed matter, not perl) accomplish:

sort <filename> | uniq -d 

could (needn't sort it):

awk '{++a[$0]; if(a[$0] == 2) print}' 

Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -