Thanks,#!/usr/bin/perl -w use strict; my $ip = '192.168.1.4; my $txt = 'Removed ' . $ip . ' by Dru'; my $file = '/data/syslog/log.backup'; open (FILE, "+<$file") or die "Can't open $file: $!\n"; while (<FILE>){ if (/.*\b$ip\b.*/){ # I thought this would work, but it doesn't s/$_/$txt/; print FILE; } }
In reply to Replacing Lines in a File by Dru
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |