|laziness, impatience, and hubris
Get unique fields from fileby sroux (Sexton)
|on Jan 06, 2022 at 09:22 UTC
sroux has asked for the wisdom of the Perl Monks concerning the following question:
As many I use Perl as a swiss army knife, I may understand the code, write some but also copy and glue it together to make scripts used on a desktop (as utility) or server (file parsing, mapping etc.).
I would like to write an utility that reads a file (can be max 500mb) and output a result with unique values >> for each delimited field << (what I mean is not an doing an unique on the whole file content but field by field).
Looks like that hashes are a nice solution for this task but I never used hashes.
I found some scripts around:
#Create hash based on header
Now how to get the unique value for each field and produce an output file. I had this piece of code used somewhere but I hardly can understand it:
Thank you for any guidance you may provide.