Update:
Thanks everyone for the help.
I ended up using Mug's version.
**
#/usr/bin/perl
use strict;
use warnings;
my $csv = 'auth.txt'; # replace your csv file name here
open FH, $csv or die "canot open file $csv: $!\n";
for()
{
close TEMP;
rename $file, $temp;
}
}
I quite afraid the $1, $2 ... will easily mixed up, on the scopes.
HTH too, code not tested too =)
Don't tested. Hopes help
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Tu
Oops, The 23rd line should be
rename $temp, $file;
> -Original Message-
> From: Zhao, Bingfeng [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, August 14, 2007 12:37 PM
> To: [EMAIL PROTECTED]; beginners@perl.org
> Subject: RE: Find and replace from CSV
>
> use s
m: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, August 14, 2007 1:39 AM
> To: beginners@perl.org
> Cc: [EMAIL PROTECTED]
> Subject: Re: Find and replace from CSV
>
> On Aug 9, 8:12 am, [EMAIL PROTECTED] wrote:
> > Hi, I am new to Perl.
> >
> > I a
On Aug 9, 8:12 am, [EMAIL PROTECTED] wrote:
> Hi, I am new to Perl.
>
> I am trying to replace a string within a bunch of html files.
>
> Ideally, I would like to have the file name pulled from a list in a
> text file, open the file, search for the string that will be replaced
> within the file, pu
Thanks for all of the help.
To answer Paul's first question, I think I didn't explain very well
what I am trying to do.
There are a few thousand html files that I need to modify. There is a
string that I need to replace that will be different in each file.
example: author_id = '6" (the 60k
On 8/10/07, Purohit, Bhargav <[EMAIL PROTECTED]> wrote:
snip
> X="Hi"
> Export $X
> Perl -e 'print $ENV{x}'
>
> But it also do not works !
snip
That is because "Export $X" is not shell code (or at least not any
shell I am familiar with). Even "export $X", which is valid shell
code, won't do what
-Original Message-
From: Jeff Pang [mailto:[EMAIL PROTECTED]
Sent: Friday, August 10, 2007 10:54 AM
To: beginners@perl.org
Subject: Re: Find and replace from CSV
-Original Message-
>From: Jeff Pang <[EMAIL PROTECTED]>
>#!/bin/sh
>FILE=$1
>REPLACED=$2
>R
-Original Message-
>From: Jeff Pang <[EMAIL PROTECTED]>
>#!/bin/sh
>FILE=$1
>REPLACED=$2
>REPLACEMENT=$3
>
>perl -pi.bak -e 's/\Q$REPLACED\E/$REPLACEMENT/' $FILE
>echo "DONE"
>
Found the problem,here shell variables can't be passed into Perl program.
Maybe using environment variables,or
-Original Message-
>From: [EMAIL PROTECTED]
>Sent: Aug 9, 2007 11:12 PM
>To: beginners@perl.org
>Subject: Find and replace from CSV
>
>Hi, I am new to Perl.
>
>I am trying to replace a string within a bunch of html files.
>
>Ideally, I would like to have the file name pulled from a list i
On Aug 9, 11:12 am, [EMAIL PROTECTED] wrote:
> I am trying to replace a string within a bunch of html files.
so why does your subject say CSV?
> Ideally, I would like to have the file name pulled from a list in a
> text file, open the file, search for the string that will be replaced
> withi
11 matches
Mail list logo