Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 501
  • 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

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

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