you can also Tie::File.
On Wed, Jun 17, 2009 at 2:42 PM, Irfan Sayed wrote:
> Hi All,
>
> I am struggling with file handling in perl. i want to do following
> operation .
>
> 1: open the file
> 2: read the file
> 3: do the changes in specific lines
> 4: save the file
> 5: close the file
>
> i am
On Wed Jun 17 2009 @ 3:42, Ajay Kumar wrote:
> Hi Irfan
> You can do all four task like below
>
> 1: open FILE ,">filename.txt" or die$!;
> 2: my @lines=
> 3: do changes through sed
> Like sed -e 's/original pattern/new pattern/p' filename
> 4:if you did changes it automatically get saved
There's actually even a perl function called "rename" that does just
this. Here's some good reading for you. Maybe from there you can
look up other stuff when you have questions.
http://perldoc.perl.org/functions/rename.html
Aimee Mostella Cardena
Irfan Sayed wrote:
> OK. fine
> now i am able to write in a temp. file
>
> after this now i want to overwrite the contents of original file with the
> contents of temp. file.
> why i want the original file because i want to use this original file
> with changes in temp. file in my further build s
Irf
From: Thomas Bätzler
To: beginners@perl.org
Cc: Irfan Sayed
Sent: Wednesday, June 17, 2009 5:38:45 PM
Subject: AW: file handle in perl
Irfan Sayed asked:
> i am still not able to modify existing lines in the existing file.
> here is my code
> plz
Irfan Sayed asked:
> i am still not able to modify existing lines in the existing file.
> here is my code
> plz help
It doesn't work that way. Once you open the file for writing, it's truncated
and you can't read the old contents from it anymore.
Why don't you use a temporary new file for the o
uot;$chver\n";
while () {
if ($_ =~ m/"OutputFilename"/) {
$_ =~ s/(\d*.\d*.\d*).msi/$chver.msi/;
print OUT "$_\n";
}
}
close FILE;
}
From: Irfan Sayed
To: "beginners@perl.org"
Sent: Wednesday, June 17, 2009 4:02:47 PM
Subje
thanks all
From: Ajay Kumar
To: Irfan Sayed
Cc: "beginners@perl.org"
Sent: Wednesday, June 17, 2009 3:42:41 PM
Subject: RE: file handle in perl
Hi Irfan
You can do all four task like below
1: open FILE ,">filename.txt" or die$!;
2: m
-Original Message-
From: Irfan Sayed [mailto:irfan_sayed2...@yahoo.com]
Sent: Wednesday, June 17, 2009 2:42 PM
To: beginners@perl.org
Subject: file handle in perl
Hi All,
I am struggling with file handling in perl. i want to do following operation .
1: open the file
2: read the file
3: do
Hi Irfan,
Irfan Sayed wrote:
I am struggling with file handling in perl. i want to do following operation .
1: open the file
2: read the file
3: do the changes in specific lines
4: save the file
5: close the file
Does this FAQ help?
Q: How do I change, delete, or insert a line in a file,
Hi All,
I am struggling with file handling in perl. i want to do following operation .
1: open the file
2: read the file
3: do the changes in specific lines
4: save the file
5: close the file
i am not getting which operand i should use to do this operation . i tried all
operands like >, >>, <,
11 matches
Mail list logo