Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Re: Seeking guidance on how to approach a task

by injunjoel (Priest)
on Dec 16, 2005 at 21:56 UTC ( #517379=note: print w/replies, xml ) Need Help??

in reply to Seeking guidance on how to approach a task

Untested Suggestion
#!/usr/bin/perl -w use strict; my %unique_values; #open file two first and read in the values of interest unless(open(F2, "file2name.txt")){ die "a horrible death!"; }else{ #line by line split off the first word i.e. user01, user02, etc %unique_values = map{ (split / /,$_)[0], undef }<F2>; close F2; unless(open(F1, "file1name.txt")){ die "a horrible death!"; }else{ while(<F1>){ chomp; if(exists($unique_values{$_}){ delete $unique_values{$_}); } } close F1; } } #open a file for output unless(open(OUT, ">outputfile.txt")){ die "again we fail!"; }else{ print $_."\n" for(sort keys %unique_values); close OUT; }
Basically open the second file first... since its got the unique values of interest. Load in the values into a hash, for easy lookup, and open the first file. if the value is already in the hash delete it!

"I do not feel obliged to believe that the same God who endowed us with sense, reason and intellect has intended us to forego their use." -Galileo

Replies are listed 'Best First'.
Re^2: Seeking guidance on how to approach a task
by mark_nelson (Initiate) on Dec 19, 2005 at 16:27 UTC
    First, thank you to everyone for the replies. I apologize for the tardiness of my respnose back but I've been through airport hell this weekend and I'm just getting back to the task at hand.

    InjunJoel and SamCG:
    Thank you for posting the code and I'll read through it and definately learn from it!

    A database is something I hadn't thought of. I might be able to get the change control to let me install mysql on the box altho I have minimal exposure to sql.

    This process will only have to be run once a night so that helps from what I'm seeing in your post.

    That makes sense too! Thank you for the code example!

    Cpan! got it! I was reading some of that but there is alot to wade through!

    I do have cygwin installed on the box so Join is an option.

    To all:

    Thank you for being so informative with your replies. I have multiple paths to look at and learn from. I am reading man pages and the camel book but its taking some time.


Log In?

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2019-07-20 07:18 GMT
Find Nodes?
    Voting Booth?

    No recent polls found