Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Seeking guidance on how to approach a task

by ambrus (Abbot)
on Dec 17, 2005 at 17:04 UTC ( [id://517508]=note: print w/replies, xml ) Need Help??


in reply to Seeking guidance on how to approach a task

There's an alternative to do this kind of thing with the standard unix text utilities instead of perl. Of course, you might not want to do that if you want to learn perl.

So here's the method.

[am]king ~/a/tm$ cat emails user01 user01@emailaddress.com user03 user03@emailaddress.com user04 user04@emailaddress.com [am]king ~/a/tm$ cat names user01 user02 user03
First, you sort the two files on their first field. They appear sorted in this example, but it's always best to go for sure.
[am]king ~/a/tm$ sort -k1 emails > emails.sort [am]king ~/a/tm$ sort -k1 names > names.sort
Then, you use join to find the unpairable names in emails.sort.
[am]king ~/a/tm$ join -v1 -o0 emails.sort names.sort user04
You might also be able to use the comm utility instead of join. Update 2009 sep 2.

See Re^2: Joining two files on common field for a list of other nodes where unix textutils is suggested to merge files.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://517508]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2024-03-29 07:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found