Script for auto conf

2014-12-29 Thread Alan Glait
Hi ! I have the Idea to make a perl script (better than in bash) to make some configuration on linux. I think to have some files like param.txt with some lines like: param_one = ZZZ XX VV param_two = Z param_three = X so need to check if param_one is in some_file.conf and if it is the

Re: Script for auto conf

2014-12-29 Thread Mike
I have a feeling this could easier be accomplished with bash. On 12/29/14 9:47 PM, Alan Glait wrote: Hi ! I have the Idea to make a perl script (better than in bash) to make some configuration on linux. I think to have some files like param.txt with some lines like: param_one = ZZZ XX VV

Re: Script for auto conf

2014-12-29 Thread Brandon McCaig
On Tue, Dec 30, 2014 at 12:47:13AM -0300, Alan Glait wrote: > Hi ! Hello, > I have the Idea to make a perl script (better than in bash) to make some > configuration on linux. > I think to have some files like param.txt with some lines like: > param_one = ZZZ XX VV > param_two = Z > p

Re: Script for auto conf

2014-12-30 Thread Andrew Solomon
Hi Alan This is the module I'd use for it: https://metacpan.org/pod/Config::Tiny The simplest approach would be to: * read the destination config file (some_file.conf) into $Config_current * read the config in-tray (param.txt) into $Config_new * add the in-tray parameters to $Config_current fo

Re: Script for auto conf

2014-12-30 Thread Alan Glait
Thanks to all !!! You are right Brandon .. Sorry about my post. I started searching how to compare 2 files like this: use strict; use warnings; my $f1 = 'E:\upload\new\2.txt'; my $f2 = 'E:\upload\new\a.txt'; my $outfile = 'E:\upload\new\1.txt'; my %results = (); open FILE1, "$f1" or die "Could not

Re: Script for auto conf

2014-12-30 Thread Ilan Shlossman
comparring 2 files: `sort $filesToCompre[0] >/dev/null 2>&1`; `sort $filesToCompre[1] >/dev/null 2>&1`; `comm -23 $filesToCompre[0] $filesToCompre[1] > $Diff_File`; `comm -13 $filesToCompre[0] $filesToCompre[1*] * >>$Diff_File`; On Tue, Dec 30, 2014 at 1:22 PM, Alan Glait wrote:

Re: Script for auto conf

2014-12-30 Thread Shlomi Fish
Hi Ilan, On Tue, 30 Dec 2014 13:31:45 +0200 Ilan Shlossman wrote: > comparring 2 files: > > `sort $filesToCompre[0] >/dev/null 2>&1`; > > `sort $filesToCompre[1] >/dev/null 2>&1`; > > > > `comm -23 $filesToCompre[0] $filesToCompre[1] > $Diff_File`; > > `comm -13 $filesToCompre[0] $fi

Re: Script for auto conf

2014-12-30 Thread Ilan Shlossman
Hi Shlomi This comparing method work fine, you can use sysyem() instead of ` ` , but the output will be the same. By the way , I'm looking for a new position in scripting area . Thanks Ilan On Tue, Dec 30, 2014 at 1:57 PM, Shlomi Fish wrote: > Hi Ilan, > > On Tue, 30 Dec 2014 13:31:45 +0200 >