Usage:
$ perl profanity optional dirpaths . is searched by default
$ perl profanity
./profanity : 42 : turds
This proggie will probably never make use of the Pod::Usage/Getopt::Long combo.#!/usr/bin/perl use File::Find(); use Regexp::Common qw /profanity/; use strict; use warnings; @ARGV = '.' unless @ARGV; File::Find::find( { wanted => \&wanted, no_chdir => 1, }, @ARGV ); exit(0); sub wanted { isProfane( $_ ) if -r $_ and -T _; } sub isProfane { my( $file, $fh ) = @_; open $fh, '<', $file or die "couldn't read $file : $!"; while( readline $fh ){ for my $w( /$RE{profanity}{-keep}/g ){ print "$file : $. : $w\n"; } } close $fh; } # Soylent Cowflop is people, people! # That's probably why turds make great manure. # ~~~~~~~~~~~~~~~~~~~~^^^^^
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: profanity here?
by benn (Vicar) on Jun 09, 2003 at 10:37 UTC | |
|
Re: profanity here?
by Aristotle (Chancellor) on Jun 09, 2003 at 12:04 UTC | |
|
Re: profanity here?
by shotgunefx (Parson) on Jun 09, 2003 at 19:44 UTC | |
by grantm (Parson) on Jun 10, 2003 at 09:23 UTC | |
by shotgunefx (Parson) on Jun 10, 2003 at 09:35 UTC |