draper7 has asked for the wisdom of the Perl Monks concerning the following question:
Thanks,#!/usr/bin/perl -w # # simple search and replace script - # for a snort rule # use strict; my $policy_file = "/usr/local/snort/rules/rules-new/policy.rules"; open(FILE,"$policy_file"); my @old_policy = <FILE>; close(FILE); open(FILE,">$policy_file"); for (@old_policy) { if (/^alert ip 63.251/) { $_ = "#$_"; } print FILE $_; } close(FILE);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Simple Search and Replace?
by dragonchild (Archbishop) on Mar 26, 2003 at 18:04 UTC | |
|
Re: Simple Search and Replace?
by zby (Vicar) on Mar 26, 2003 at 18:10 UTC | |
by draper7 (Scribe) on Mar 26, 2003 at 19:16 UTC | |
by draper7 (Scribe) on Mar 26, 2003 at 19:28 UTC | |
by zby (Vicar) on Mar 26, 2003 at 19:28 UTC | |
|
Re: Simple Search and Replace?
by OM_Zen (Scribe) on Mar 26, 2003 at 18:10 UTC | |
|
Re: Simple Search and Replace?
by nadadogg (Acolyte) on Mar 26, 2003 at 20:39 UTC |