• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 504
  • Last Modified:

Simple Perl Script to get Unique values from file

It has been a few years since I have used Perl.  I have a text file with about 400 entries.  There are duplicates in the file.  An example of the input file would be.

smith
jones
taylor
smith
bruce

I need a output file with only the unique values.  An example of the output file

smith
jones
taylor
bruce

order is not important - I just need the unique values

0
jkteater
Asked:
jkteater
1 Solution
 
ozoCommented:
see
perldoc -q duplicate

perl -lne 'print unless $seen{$_}++' <inputfile > outputfile
0
 
jkteaterAuthor Commented:
Thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now