Update config file using shell script in Solaris 5.10

hi
I need to update the value in config.txt value using shell script
example:
lets say a value in config.txt file is as SEQUENCE=1
after some iteration as the loop ends , the SEQUENCE should get update in the config.txt file with a new value of SEQUENCE=2 .

also , can anyone please help me in incrementing the date vlaue in the shell script
example/:
two variables
1) START DATE=dd/mm/yyyy
2) Period=10
the logic required is to add the period to the start date and increment the start date
e.g.

START DATE=04/03/2014
Period=10
END DATE= 14/3/2014

Is this a homework assignment?

NO Don,
its kind of a POC tht i was doing and got stuck into ....

I could interpret:

several ways. Is the setting to be used on the line containing START DATE related to today's date, or just the value currently found in the file? Please describe this in better detail and show us a complete starting config.txt and the exact resulting updated config.txt that you want to be produced (using CODE tags).

Do you have the GNU date utility installed on your system?

What shell are you using?

thanks for you reply Don,

it would be the date which is mentioned in the file below is how my config.txt file is

config.txt
---------------

ORACLE_HOME=/opt2/oracle/productc/11.2.0/dbhome_1
ORACLE_BASE=/opt2/oracle/productc/11.2.0/dbhome_1
START_DATE=31-12-2013
END_DATE=31-01-2014
PERIOD=10
FLAG=A
MAX_SIZE=1
LAST_FEED=N
SEQUENCE=1

the above is how the config.txt file is , we would read the START_DATE value from config.txt via scripting and store the same in variable
(example

START_RUN_DATE=`cat $CONFIG_FILE | grep START_DATE=|cut -f2 -d'='`
PERIOD=`cat $CONFIG_FILE | grep PERIOD=|cut -f2 -d'=' | head -1`   ) 

after reading this above value we need sum up like

example if
START_DATE=04-03-2014
PERIOD=10

result should be as 14-03-2014

---------- Post updated at 04:14 AM ---------- Previous update was at 04:01 AM ----------

forgot to update on GNU and Shell which we are using on my last post

we don't have GNU utility installed and we cannot install the same in our live environment
and we are using SunOS 5.10 Generic_147440-07 sun4v sparc sun4v

thanks

You have now shown us a sample input file. I repeat:

In particular; does the resulting date go on the line with START DATE (or START_DATE ) or on the line with END DATE (or END_DATE )? Note that your 1st message said the strings containing the dates had spaces between the words, while your last post had underscores between the words??? Which is it?

we don't have GNU utility installed and we cannot install the same in our live environment
and we are using KSH (SunOS 5.10 Generic_147440-07 sun4v sparc sun4v)

this is starting my config file
---------------------------------------------------

USER=MIS_EXTRACT
PASSWD=MIS_EXTRACT
DATABASE=WLR1
ORACLE_HOME=/opt2/oracle/productc/11.2.0/dbhome_1
ORACLE_BASE=/opt2/oracle/productc/11.2.0/dbhome_1
START_DATE=31-12-201300:00:00
END_DATE=31-03-201400:00:00
PERIOD=10
FLAG=A
MAX_SIZE=1
LAST_FEED=N
SEQUENCE=1

---------------------------------------------

after execution it shd be as below config.txt
--------------------------------------

USER=MIS_EXTRACT
PASSWD=MIS_EXTRACT
DATABASE=WLR1
ORACLE_HOME=/opt2/oracle/productc/11.2.0/dbhome_1
ORACLE_BASE=/opt2/oracle/productc/11.2.0/dbhome_1
START_DATE=10-01-2014
END_DATE=31-03-2014
PERIOD=10
FLAG=A
MAX_SIZE=1
LAST_FEED=N
SEQUENCE=1

--------------------------------------

the above is how are expecting

The most important thing you need to remember when writing a shell script (or any software) is that you need to know what that script is supposed to do. In trying to get a specification of what this script is supposed to do, you have now given us three conflicting sets of requirements.

  1. In one case the END?DATE and START?DATE variables have a space where the ? characters are; in two cases they have _ characters.
  2. In one case the format of the data in those variables in dd/mm/yyyyHH:MM:SS , in two cases the format is dd/mm/yyyy .
  3. In one case, the value assigned to the variable SEQUENCE is supposed to be incremented; in one it is not modified; and in the other, there is no mention of this variable.
  4. In two cases it is unclear whether one or both of the (START|END)[ _]DATE variables are supposed to be updated; in one case it is clear that both are to be updated.

When you can give us a clear English description of what your script is supposed to do, show us sample input (using CODE tags), and show us sample output (using CODE tags) that matches that description; we will have something we can work with. The volunteers who try to help answer issues raised in The UNIX and Linux Forums want to help you learn how to use the tools provided on these systems to do things you want to do. Trying to write software to meet a moving set of requirements is frustrating (and usually just a waste of time).