Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Removing users from a list

by 2teez (Priest)
on Sep 09, 2012 at 00:41 UTC ( #992544=note: print w/replies, xml ) Need Help??


in reply to Removing users from a list

Hi,

What have you tried using Perl?
Really, there is no way, one can help except giving "assumed" examples, since no code, examples, likes or modified script was not given.
However, if this might help.
Get all the user from the masterlist.txt, then iterate through the removelist.txt, to remove from the masterlist hash, names contained in the removelist that matches. Then print out all the remaining users in the masterlist hash.

UPDATE:
Please, if I may illustrate the point above, using an example that could help.
Note:
This might not be the perfect example, but am sure it will give up a head up.
masterlist.txt

barak osama bush jonathan perl python java c++

removelist.txt
osama jonathan python java
#!/usr/bin/perl use warnings; use strict; my %new_list; read_n_work_file( 'masterlist.txt', sub { undef $new_list{ $_[0] } } ) +; read_n_work_file( 'removelist.txt', sub { delete $new_list{ $_[0] } if exists $new_list{ $_[0] } } ); print join "\n" => keys %new_list; # print to a new file sub read_n_work_file { my ( $file, $workout ) = @_; open my $fh, '<', $file or die "can't open file:$!"; while (<$fh>) { chomp; $workout->($_); } }

output
bush barak perl c++

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://992544]
help
Chatterbox?
[marto]: when you work on the outside, for a client, you can make them aware of the stupids, but they don' t always listen :/
[Corion]: Yeah, you can lead them to water, but it's illegal to drown them...
[Discipulus]: Here my solution marto: create a win fake machine insied AD. do a micro fake partition foreach remote partition you wont to monit. put a web server that acept from data from remote systems and full fake partition as needed. fake partition are Mb. ;=)
[marto]: Discipulus yeah, the nuclear industry love fake machines sitting around on a controlled domain :P
[marto]: changing a typo on a website is often a great deal of paper work :P

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (11)
As of 2017-01-24 10:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you watch meteor showers?




    Results (203 votes). Check out past polls.