jimmy.tty
Recent Actions
-
Commented on Day 2: When uniq is not unique enough (App::nauniq)
I think the easiest way to keep first occurrence of each line is one of: $ awk '!a[$0]++' input.txt or $ perl -ne'$h{$_}++||print' input.txt To keep the last occurrence is enough use command tac in input.txt before awk or perl...
Comment Threads
-
perlancar commented on
Day 2: When uniq is not unique enough (App::nauniq)
$ perl -ne'$h{$_}++||print' input.txt
Yup, that is what nauniq essentially does (plus some options).
About blogs.perl.org
blogs.perl.org is a common blogging platform for the Perl community. Written in Perl with a graphic design donated by Six Apart, Ltd.