Update value of variable


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Update value of variable
# 1  
Old 04-08-2015
Ubuntu Update value of variable

Hallo all..
I'm running in windows 7 and cygwin instaled so i can use linux command on that.

I want to update the value of some variable that i stored in a file. How do I update it.

this is my file look like..

Code:
variable.txt
partisi1=25
partisi2=25
partisi3=25
partisi4=25

how can i change the value of the partisi1 variable by shell script?
thank before..

Last edited by Don Cragun; 04-08-2015 at 05:37 PM.. Reason: Add CODE tags again.
# 2  
Old 04-08-2015
Take a look at sed command.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Assign Values to a Variable in While Loop and Update the File

Hello, Could anyone please help me with Assigning a value to variable and then updating the value in the original file IFS='|' while read -r Serial_ID JOB_NAME STATUS do if then echo "Perform Fuctions" ???Assign STATUS to COMPLETED and Update File??? done <File (7 Replies)
Discussion started by: infernalhell
7 Replies

2. Shell Programming and Scripting

Update a specific field in file with Variable value based on other Key Word

I have an input file with A=xyz B=pqr I would want the value in Second Field (xyz or pqr) updated with a value present in Shell Variable based on the value passed in the first field. (A or B ) while read line do NEW_VALUE = `some functionality done on $line` If $line=First Field-... (1 Reply)
Discussion started by: infernalhell
1 Replies

3. Shell Programming and Scripting

Python update variable name in for loop

Hello all, Not sure if this question has been answered already. I have some xml Element variable as below: child19 = core_elem_dcache.find('stat') child20 = core_elem_dcache.find('stat') child21 = core_elem_dcache.find('stat') child22 = core_elem_dcache.find('stat'Next I... (2 Replies)
Discussion started by: Zam_1234
2 Replies

4. Programming

MYSQL - trigger update on record insert or update

Right I have a MYSQL database with table1 with 3 columns, colA, colB and colC. I want to combine the data in the 3 columns into a 4th column names col_comb. Here's the SQL command that works: UPDATE table1 SET `col_comb` = CONCAT( `colA` , ' - ', `colB` , ', ', `colC` ); So now I want this... (5 Replies)
Discussion started by: barrydocks
5 Replies

5. Shell Programming and Scripting

Makefile doesn't update $< variable

Hello guys, I could use advise from more experienced guys about my Makefile. In short, the problem with my Makefile is that $< doesnt change inside my rule. Here is my Makefile: # Makefile for CORE CC = gcc.exe AS = as.exe AR = ar.exe INCLUDE = \ -I../lib/tomcrypt/inc \... (1 Reply)
Discussion started by: Kodreanu
1 Replies

6. UNIX for Dummies Questions & Answers

update value in a file using variable passed via unix script

I have a file in my unix directory called "restart_job1.job". Below is a sample of the script where I am doing a 'grep' to check specifically for an oracle error. If the value 'ORA-" is found, I set a variable to hold the return code value (job1_return_code). If the return code is non zero, I... (2 Replies)
Discussion started by: ncsthbell_dr
2 Replies

7. Shell Programming and Scripting

how to pass a variable to an update sql statement inside a loop

hi all, i am experiencing an error which i think an incorrect syntax for the where clause passing a variable was given. under is my code. sqlplus -s ${USERNAME}/${PASSWORD}@${SID} << END1 >> $LOGFILE whenever sqlerror exit set serveroutput on size 1000000 declare l_rc ... (0 Replies)
Discussion started by: ryukishin_17
0 Replies

8. Shell Programming and Scripting

update a string variable and use in....

Hello Forun, i have a variable searchpath="/home/shailesh/project/debug" i want to make it like searchpath="/home/shailesh/project/debug/*.mk" and want to use this like for finding all *.mk files in debug folder. for f in "$searchpath" `find -type f`; do sed... (6 Replies)
Discussion started by: shailesh_arya
6 Replies

9. Shell Programming and Scripting

ksh: A part of variable A's name is inside of variable B, how to update A?

This is what I tried: vara=${varb}_count (( vara += 1 )) Thanks for help (4 Replies)
Discussion started by: pa3be
4 Replies
Login or Register to Ask a Question