Hello all,
I am processing a text file and I need to replace all the backslashes "\" in the file with forward slashes "/". Here is my code so far:
Mike V. you migt recognize this script.
Thanks,
Nick
I am processing a text file and I need to replace all the backslashes "\" in the file with forward slashes "/". Here is my code so far:
Code:
open (OUT, ">/home/opc_op/log/pgp_in_process.log") or die ("Error opening log file: $1");
my $out = ""; # undefine $out
my $saw_error = 0; # Initialize variable to 0
foreach(@diff) {
chomp;
s/\//\\/g; # HERE IS MY SUBSTITUTION
next if /^\s*$/;
if (/^ERROR--/ || /^-/) {
if ($out) {
$out =~ s/(--)\s+/$1/;
print (OUT "$out\n");
$out = "";
$saw_error--;
}
if (/^ERROR--/) {
$saw_error++;
}
}
if ($saw_error) {
if ($out =~ /\S$/ && /^\S/) {
$out .= " ";
}
$out .= $_;
}
}
Mike V. you migt recognize this script.
Thanks,
Nick