uniq



The UNIX uniq command drops the duplicate values from it input and prints out the result.
Usually it is used in a pipe so it receives file rows and prints them on the screen
(or passes them to the next command in the pipe chain).

In Perl 6 we have a uniq function that receives a list of values and returns 
the same list after dropping any duplicate value.

"input.txt".slurp.uniq.map:{ "$_\n" }.say  

and this will work once slurp is fixed:

"input.txt".slurp.uniq.say  

will print out the uniq rows in the input.txt file to the screen





Copyright 2006, 2007, 2008, 2009, 2010 Gabor Szabo http://szabgab.com/ Index | TOC
If you are interested in on-site trainings by the author, please contact me directly.

Online courses:

Would you like to get
updated when I publish
the next article?

Follow me:

Google Plus Twitter RSS feed