Storing Output file.

2016-01-28 Thread Frank Larry
Hi Team, could you please let me? i have a file which contains "Debug", i would like to replace debug to "Error", when i ran the below program the out showing Error message but how to save the output with new changes. Could you please tell me how to fix it? open(FILE, "){ print "Before substi

Re: Storing Output file.

2016-01-28 Thread Logust Yu via beginners
You can probably achieve this easily with 'sed' on bash. > On 28 Jan 2016, at 09:37, Frank Larry wrote: > > Hi Team, > > could you please let me? i have a file which contains "Debug", i would like > to replace debug to "Error", when i ran the below program the out showing > Error message bu

Re: Storing Output file.

2016-01-28 Thread Andrew Solomon
Hi Frank Assuming the file you're operating on is bar.txt, here's how I'd do it: $ perl -i.bak -p -e 's/Debug/Error/g' bar.txt then you'll find the original file in bar.txt.bak $ diff bar.txt bar.txt.bak 1,3c1,3 < This is a Error < Please Error every replacement < with a Error --- > This

Re: Storing Output file.

2016-01-28 Thread Lars Noodén
On 01/28/2016 04:59 PM, Logust Yu via beginners wrote: > You can probably achieve this easily with 'sed' on bash. > >> On 28 Jan 2016, at 09:37, Frank Larry wrote: >> >> Hi Team, >> >> could you please let me? i have a file which contains "Debug", i would like >> to replace debug to "Error", w

Re: Storing Output file.

2016-01-28 Thread Malisetti Ram Murthy
Hi Frank, Invoke below command from your perl program to replace the string "Debug" to "Error": sed -i -e '/Debug/ r filter.txt' -e s/Debug/Error/g filter_replaced.txt Above solution is provided as per my knowledge, please post if there is any other solutions for this. Thanks, Ram Murthy On T

Re: Storing Output file.

2016-01-28 Thread Jim Gibson
> On Jan 28, 2016, at 1:37 AM, Frank Larry wrote: > > Hi Team, > > could you please let me? i have a file which contains "Debug", i would like > to replace debug to "Error", when i ran the below program the out showing > Error message but how to save the output with new changes. Could you pl

Re: Storing Output file.

2016-01-28 Thread Jonathan Harris via beginners
Hi, I found that this works, assuming that the module is installed. #!/usr/bin/perl use warnings; use strict; use File::Slurp qw ( :edit ); # my $file_to_edit = 'path-to-file.txt'; # my $word_to_edit = "Debug"; my $new_word = "Error"; # edit_file { s/$word_to_edit/$new_word/g } ( $file_to_edit );

Re: Storing Output file.

2016-01-28 Thread Frank Vino
Thank a lot brothersi will try all the things and update you.. -Frank On Thu, Jan 28, 2016 at 11:27 PM, Jonathan Harris via beginners < beginners@perl.org> wrote: > Hi, > I found that this works, assuming that the module is installed. > > #!/usr/bin/perl > use warnings; > use strict; > use F

Re: Storing Output file.

2016-01-28 Thread Frank Larry
Thank you so much for the solution you people provided. :) Warm Regards, -Franky On Thu, Jan 28, 2016 at 8:49 PM, Malisetti Ram Murthy < malisettirammur...@gmail.com> wrote: > Hi Frank, > > Invoke below command from your perl program to replace the string "Debug" > to "Error": > > sed -i -e '/De