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
Post a Comment