in reply to Re: Sort/Uniq Help
in thread Sort/Uniq Help
#!/usr/bin/perl use strict; use warnings; use File::Find; my $DIRECTORY = "/Users/data/"; find(\&edits, $DIRECTORY); sub edits() { if ( -f and /.txt$/ ) { #Find files ending in .txt and drill down al +l sub dirs my $TEXT_FILE = $_; #save the results to $_; open MATCHING_FILE, $TEXT_FILE; my @all_lines = <MATCHING_FILE>; #Place everything into an array ca +ll all_lines close MATCHING_FILE; for my $each_line ( @all_lines ) { if ( $each_line =~ /[\d]{1,3}\.[\d]{1,3}\.[\d]{1,3}\.[\d]{1,3}|pa +ssword|(ssn=)/i ) { #Search for IP or password or ssn= #print $each_line, "Found in $File::Find::name\n"; print $each_line; # Print each line that is found } } } }
what I want to do is remove the 192.168.1.1 dups from being printed along with all the other dups that show up.Results from all files in a directory 192.168.1.1 192.168.1.1 192.168.1.1 64.22.34.66 221.245.23.44 PASSWORD=FpnmRjE
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Sort/Uniq Help
by Corion (Patriarch) on Mar 17, 2008 at 18:13 UTC | |
|
Re^3: Sort/Uniq Help
by halfcountplus (Hermit) on Mar 17, 2008 at 23:53 UTC | |
|
Re^3: Sort/Uniq Help
by poolpi (Hermit) on Mar 18, 2008 at 09:48 UTC | |
by moritz (Cardinal) on Mar 18, 2008 at 10:00 UTC | |
by poolpi (Hermit) on Mar 18, 2008 at 13:47 UTC | |
by moritz (Cardinal) on Mar 18, 2008 at 14:37 UTC | |
by poolpi (Hermit) on Mar 20, 2008 at 09:36 UTC |