in reply to Remove a line from a file using perl one liner
i am just trying to help.Please do check if the windows code works.I am not sure if it could throw any errors.It works fine for a substitute for me on activeperl on windows xp.I also do the replace on all files in a directory.#!/usr/bin/perl BEGIN {(*STDERR = *STDOUT) || die;} use diagnostics; use warnings; use strict; $| = 1; my $file = full_path/one.txt; @ARGV = $file; $^I = '~'; while (<>) { binmode ARGVOUT if $. == 1; s/$string_to_be_removed//g; print; }
-Smanicka
|
|---|