<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Manage parameter-file in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/manage-parameter-file/m-p/3708983#M103573</link>
    <description>I have still an other question.&lt;BR /&gt;&lt;BR /&gt;is it possible to include a file in a shell-script file?&lt;BR /&gt;one file is the main programm the other one is the function file.&lt;BR /&gt;&lt;BR /&gt;i search something like exists in php:&lt;BR /&gt;include ("functionfile");&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Regards</description>
    <pubDate>Fri, 20 Jan 2006 03:39:34 GMT</pubDate>
    <dc:creator>Oviwan</dc:creator>
    <dc:date>2006-01-20T03:39:34Z</dc:date>
    <item>
      <title>Manage parameter-file</title>
      <link>https://community.hpe.com/t5/operating-system-linux/manage-parameter-file/m-p/3708965#M103555</link>
      <description>Hi @ll&lt;BR /&gt;&lt;BR /&gt;what is the best way to manage a parameter-file?&lt;BR /&gt;I have a file like this:&lt;BR /&gt;&lt;BR /&gt;par1=value1&lt;BR /&gt;par2=value2  #comment&lt;BR /&gt;par3=value3&lt;BR /&gt;&lt;BR /&gt;i have a menu and there is a menu-point which is called "set par1", when i choice this point comes a prompt where i can give the value for par1. after i give the value, how can i set this value in the parameter-file? and also read from the file?&lt;BR /&gt;&lt;BR /&gt;Thanks</description>
      <pubDate>Fri, 13 Jan 2006 11:57:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/manage-parameter-file/m-p/3708965#M103555</guid>
      <dc:creator>Oviwan</dc:creator>
      <dc:date>2006-01-13T11:57:15Z</dc:date>
    </item>
    <item>
      <title>Re: Manage parameter-file</title>
      <link>https://community.hpe.com/t5/operating-system-linux/manage-parameter-file/m-p/3708966#M103556</link>
      <description>*EDIT*&lt;BR /&gt;it should be in ksh.&lt;BR /&gt;&lt;BR /&gt;Regards</description>
      <pubDate>Fri, 13 Jan 2006 11:58:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/manage-parameter-file/m-p/3708966#M103556</guid>
      <dc:creator>Oviwan</dc:creator>
      <dc:date>2006-01-13T11:58:35Z</dc:date>
    </item>
    <item>
      <title>Re: Manage parameter-file</title>
      <link>https://community.hpe.com/t5/operating-system-linux/manage-parameter-file/m-p/3708967#M103557</link>
      <description>This looks like something for a shell script, so you would use "." command to assign your shell variables. Then to update the param file, write all the params back. Example-&lt;BR /&gt; &lt;BR /&gt;par2=23&lt;BR /&gt;( &lt;BR /&gt;echo "par1=$par1"&lt;BR /&gt;echo "par2=$par2   #comment"&lt;BR /&gt;echo "par3=$par3"&lt;BR /&gt;) &amp;gt;yourparamfile&lt;BR /&gt; &lt;BR /&gt;HTH&lt;BR /&gt; &lt;BR /&gt;-- Rod Hills</description>
      <pubDate>Fri, 13 Jan 2006 12:03:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/manage-parameter-file/m-p/3708967#M103557</guid>
      <dc:creator>Rodney Hills</dc:creator>
      <dc:date>2006-01-13T12:03:22Z</dc:date>
    </item>
    <item>
      <title>Re: Manage parameter-file</title>
      <link>https://community.hpe.com/t5/operating-system-linux/manage-parameter-file/m-p/3708968#M103558</link>
      <description>Thanks&lt;BR /&gt;&lt;BR /&gt;what is the best way to read one value from the parameter-file?&lt;BR /&gt;&lt;BR /&gt;and something other:&lt;BR /&gt;what means "set -x"?</description>
      <pubDate>Mon, 16 Jan 2006 07:46:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/manage-parameter-file/m-p/3708968#M103558</guid>
      <dc:creator>Oviwan</dc:creator>
      <dc:date>2006-01-16T07:46:58Z</dc:date>
    </item>
    <item>
      <title>Re: Manage parameter-file</title>
      <link>https://community.hpe.com/t5/operating-system-linux/manage-parameter-file/m-p/3708969#M103559</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;One easy way to extract one parameter's value from your file is to use 'awk'.&lt;BR /&gt;&lt;BR /&gt;# echo "par2=value2"|awk '/par2/ {split($0,a,/=/);print a[2]}'&lt;BR /&gt;&lt;BR /&gt;..returns (prints) value2&lt;BR /&gt;&lt;BR /&gt;# X=`echo "par2=value2"|awk '/par2/ {split($0,a,/=/);print a[2]}'`&lt;BR /&gt;&lt;BR /&gt;Thus ${X} now contains 'value2', the value of 'par2'.&lt;BR /&gt;&lt;BR /&gt;As for the shell construct 'set -x' --- this prints the shell commands as they are executed.  This is useful in debugging.  See the man pages for 'sh-psix' for more information.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Mon, 16 Jan 2006 07:56:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/manage-parameter-file/m-p/3708969#M103559</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-01-16T07:56:17Z</dc:date>
    </item>
    <item>
      <title>Re: Manage parameter-file</title>
      <link>https://community.hpe.com/t5/operating-system-linux/manage-parameter-file/m-p/3708970#M103560</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;I should generalize a bit; sorry.  Given your parameter file is composed with "=" as the delimiter betweeen parameter and value, to find the value of parameter "X":&lt;BR /&gt;&lt;BR /&gt;# X=par2;awk '{if ($1~X) {split($0,a,/=/);print a[2]}}' X=$X parmfile&lt;BR /&gt;&lt;BR /&gt;...returns the value of 'par2'.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;</description>
      <pubDate>Mon, 16 Jan 2006 08:13:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/manage-parameter-file/m-p/3708970#M103560</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-01-16T08:13:46Z</dc:date>
    </item>
    <item>
      <title>Re: Manage parameter-file</title>
      <link>https://community.hpe.com/t5/operating-system-linux/manage-parameter-file/m-p/3708971#M103561</link>
      <description>Ty&lt;BR /&gt;&lt;BR /&gt;is there also a way to write a new value in the parameter-file without rewrite the whole parameter-file? also with awk.</description>
      <pubDate>Mon, 16 Jan 2006 09:01:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/manage-parameter-file/m-p/3708971#M103561</guid>
      <dc:creator>Oviwan</dc:creator>
      <dc:date>2006-01-16T09:01:56Z</dc:date>
    </item>
    <item>
      <title>Re: Manage parameter-file</title>
      <link>https://community.hpe.com/t5/operating-system-linux/manage-parameter-file/m-p/3708972#M103562</link>
      <description>Hi Oviwan:&lt;BR /&gt;&lt;BR /&gt;Yes, you can update your file's parameters in place with perl:&lt;BR /&gt;&lt;BR /&gt;# perl -i.old -ple 's/par2=.+\b/par2=newvalue/' parmsfile&lt;BR /&gt;&lt;BR /&gt;...would make a backup copy "parmsfile.old" and update inplace the value of 'par2' changing it from whatever follows the "=" character to "newvalue".&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Mon, 16 Jan 2006 09:52:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/manage-parameter-file/m-p/3708972#M103562</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-01-16T09:52:22Z</dc:date>
    </item>
    <item>
      <title>Re: Manage parameter-file</title>
      <link>https://community.hpe.com/t5/operating-system-linux/manage-parameter-file/m-p/3708973#M103563</link>
      <description>Hi,&lt;BR /&gt;I suggest:&lt;BR /&gt;grep ^par1 parameter-file|cut -d"=" -f2|sed 's/^ *//g'&lt;BR /&gt;In this way you can have any number of spaces between = and the parameter value.&lt;BR /&gt;HTH,&lt;BR /&gt;Art</description>
      <pubDate>Mon, 16 Jan 2006 09:58:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/manage-parameter-file/m-p/3708973#M103563</guid>
      <dc:creator>Arturo Galbiati</dc:creator>
      <dc:date>2006-01-16T09:58:50Z</dc:date>
    </item>
    <item>
      <title>Re: Manage parameter-file</title>
      <link>https://community.hpe.com/t5/operating-system-linux/manage-parameter-file/m-p/3708974#M103564</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;Arturo's point about embedded spaces is easily managed:&lt;BR /&gt;&lt;BR /&gt;# perl -i.old -ple 's/par2\s*=.+\b/par2=newvalue/' parmsfile&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Mon, 16 Jan 2006 10:06:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/manage-parameter-file/m-p/3708974#M103564</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-01-16T10:06:21Z</dc:date>
    </item>
    <item>
      <title>Re: Manage parameter-file</title>
      <link>https://community.hpe.com/t5/operating-system-linux/manage-parameter-file/m-p/3708975#M103565</link>
      <description>Thanks @ll&lt;BR /&gt;&lt;BR /&gt;is there also a chance to do this:&lt;BR /&gt;# perl -i.old -ple 's/par2\s*=.+\b/par2=newvalue/' parmsfile&lt;BR /&gt;in ksh or awk? nice solution with perl, but i wouldn't mix a lot of programming languages, if possible only ksh and awk.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 16 Jan 2006 10:24:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/manage-parameter-file/m-p/3708975#M103565</guid>
      <dc:creator>Oviwan</dc:creator>
      <dc:date>2006-01-16T10:24:29Z</dc:date>
    </item>
    <item>
      <title>Re: Manage parameter-file</title>
      <link>https://community.hpe.com/t5/operating-system-linux/manage-parameter-file/m-p/3708976#M103566</link>
      <description>Hi Oviwan:&lt;BR /&gt;&lt;BR /&gt;Perl's regular expression handling is one of the best available.  Since perl allows updating in-place, whereas 'awk' or 'sed' force you to redirect modified output into a second file and then rotate that second file over the first, I also choose perl for this task.&lt;BR /&gt;&lt;BR /&gt;As far as mixing various languages, then, one sees this all the time in shell scripts.  Consider the number of shell lines with 'sed' and 'awk' snippets.  If a shell uses 'cut' or 'grep' in reality that too is mixing languages since the later are C-code.&lt;BR /&gt;&lt;BR /&gt;Could your requirement be met wholly in shell?  Well, yes.  For instance, you could parse your parameter file by using the shell's IFS (inter-field-separator) much along the lines of what I did with 'split' in the 'awk' code.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Mon, 16 Jan 2006 10:34:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/manage-parameter-file/m-p/3708976#M103566</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-01-16T10:34:19Z</dc:date>
    </item>
    <item>
      <title>Re: Manage parameter-file</title>
      <link>https://community.hpe.com/t5/operating-system-linux/manage-parameter-file/m-p/3708977#M103567</link>
      <description>You are right, but what is more professional? to mix a lot of languages or only use of one or two (if possible)?&lt;BR /&gt;how do you handle this at your own?</description>
      <pubDate>Mon, 16 Jan 2006 10:45:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/manage-parameter-file/m-p/3708977#M103567</guid>
      <dc:creator>Oviwan</dc:creator>
      <dc:date>2006-01-16T10:45:51Z</dc:date>
    </item>
    <item>
      <title>Re: Manage parameter-file</title>
      <link>https://community.hpe.com/t5/operating-system-linux/manage-parameter-file/m-p/3708978#M103568</link>
      <description>Hi Oviwan:&lt;BR /&gt;&lt;BR /&gt;You asked, "...what is more professional? to mix a lot of languages or only use of one or two (if possible)?  how do you handle this at your own?"&lt;BR /&gt;&lt;BR /&gt;I prefer to drive screws with screwdrivers and nails with hammers.  By this I mean, I perfer to do things easily and gracefully with the tools that offer both ease of use and good performance.&lt;BR /&gt;&lt;BR /&gt;Just because you can do something in language X doesn't mean that you should.  I want readable, maintainable (flexible) code that performs well using a minimum of server resources in that order.  Sometimes mixing two languages (e.g. shell + awk or shell + sed or shell + perl) is an easy solution.  The whole Unix philosophy is built around the idea of plumbing and to me this is one case of it.&lt;BR /&gt;&lt;BR /&gt;Certainly as one becomes more familar and proficient with a language, like any tool, one tends to grab it at the start of a project.  Many of the tasks we do in shell scripts could be re-written in perl.  In cases where a working piece of code already exists I find no harm in leveraging another language for a small subtask.&lt;BR /&gt;&lt;BR /&gt;"Mixing" languages is really nothing more than calling modules or libraries and that generally means making things easier in my opinion.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Mon, 16 Jan 2006 11:14:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/manage-parameter-file/m-p/3708978#M103568</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-01-16T11:14:45Z</dc:date>
    </item>
    <item>
      <title>Re: Manage parameter-file</title>
      <link>https://community.hpe.com/t5/operating-system-linux/manage-parameter-file/m-p/3708979#M103569</link>
      <description>Thanks JRF for your opinion and the code.&lt;BR /&gt;&lt;BR /&gt;Regards Oviwan</description>
      <pubDate>Mon, 16 Jan 2006 11:53:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/manage-parameter-file/m-p/3708979#M103569</guid>
      <dc:creator>Oviwan</dc:creator>
      <dc:date>2006-01-16T11:53:53Z</dc:date>
    </item>
    <item>
      <title>Re: Manage parameter-file</title>
      <link>https://community.hpe.com/t5/operating-system-linux/manage-parameter-file/m-p/3708980#M103570</link>
      <description>One question to JRF's perl:&lt;BR /&gt;&lt;BR /&gt;why doesn't work my adjustment? the parameter file doesn't change:&lt;BR /&gt;echo $par_name $par_value | perl -i.old -F: -ple 's/^$F[0]\s*=.*\b/$F[0]=$F[1]/o' ${prg_path}${prg_par_file}&lt;BR /&gt;&lt;BR /&gt;output of set -x:&lt;BR /&gt;+ echo db_name PROD&lt;BR /&gt;+ perl -i.old -F: -ple s/^$F[0]\s*=.*\b/$F[0]=$F[1]/o /home/oracle/scripts/file.par&lt;BR /&gt;&lt;BR /&gt;are my perl parameters wrong? or is there another chance to include the shell variable $par_name in the perl?&lt;BR /&gt;&lt;BR /&gt;Thanks a lot</description>
      <pubDate>Tue, 17 Jan 2006 05:28:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/manage-parameter-file/m-p/3708980#M103570</guid>
      <dc:creator>Oviwan</dc:creator>
      <dc:date>2006-01-17T05:28:02Z</dc:date>
    </item>
    <item>
      <title>Re: Manage parameter-file</title>
      <link>https://community.hpe.com/t5/operating-system-linux/manage-parameter-file/m-p/3708981#M103571</link>
      <description>Hi Oviwan:&lt;BR /&gt;&lt;BR /&gt;I you last post, there are several things amiss.  It looks like you are attempting to autosplit on the ":" character but you don't specify '-a' nor do you explicity 'split' $_.&lt;BR /&gt;&lt;BR /&gt;What you want to do is let the shell expand your variables and then present them to the perl snippet:&lt;BR /&gt;&lt;BR /&gt;# arg=par2;val=newvalue;perl -i.old -ple "s/$arg\s*=.+\b/$arg=$val/" parmsfile&lt;BR /&gt;&lt;BR /&gt;Note that this is a variation on my last post.  By using double-quotes I let the shell evaluate the $arg and $val variables before perl runs.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Tue, 17 Jan 2006 08:00:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/manage-parameter-file/m-p/3708981#M103571</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-01-17T08:00:41Z</dc:date>
    </item>
    <item>
      <title>Re: Manage parameter-file</title>
      <link>https://community.hpe.com/t5/operating-system-linux/manage-parameter-file/m-p/3708982#M103572</link>
      <description>Thanks a lot, now it works perfectly!&lt;BR /&gt;&lt;BR /&gt;I have every time troubles with this quotes ("'`) :(&lt;BR /&gt;&lt;BR /&gt;Regards</description>
      <pubDate>Tue, 17 Jan 2006 08:23:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/manage-parameter-file/m-p/3708982#M103572</guid>
      <dc:creator>Oviwan</dc:creator>
      <dc:date>2006-01-17T08:23:55Z</dc:date>
    </item>
    <item>
      <title>Re: Manage parameter-file</title>
      <link>https://community.hpe.com/t5/operating-system-linux/manage-parameter-file/m-p/3708983#M103573</link>
      <description>I have still an other question.&lt;BR /&gt;&lt;BR /&gt;is it possible to include a file in a shell-script file?&lt;BR /&gt;one file is the main programm the other one is the function file.&lt;BR /&gt;&lt;BR /&gt;i search something like exists in php:&lt;BR /&gt;include ("functionfile");&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Regards</description>
      <pubDate>Fri, 20 Jan 2006 03:39:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/manage-parameter-file/m-p/3708983#M103573</guid>
      <dc:creator>Oviwan</dc:creator>
      <dc:date>2006-01-20T03:39:34Z</dc:date>
    </item>
    <item>
      <title>Re: Manage parameter-file</title>
      <link>https://community.hpe.com/t5/operating-system-linux/manage-parameter-file/m-p/3708984#M103574</link>
      <description>Hi Oviwan:&lt;BR /&gt;&lt;BR /&gt;You asked if it is possible to include a file in a shell script.  Yes, the process is called "sourcing" a file.  You cause this by writing a "dot" followed by a "blank" followed by the file name:&lt;BR /&gt;&lt;BR /&gt;#/usr/bin/sh&lt;BR /&gt;echo "the next line says include the file"&lt;BR /&gt;. $HOME/includeme&lt;BR /&gt;echo "done"&lt;BR /&gt;&lt;BR /&gt;This technique is often used to include environmental variables from a common file into a script instead of declaring them in a login profile.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Fri, 20 Jan 2006 06:26:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/manage-parameter-file/m-p/3708984#M103574</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-01-20T06:26:40Z</dc:date>
    </item>
  </channel>
</rss>

