Script to increase Timeout values in Configuration File


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Script to increase Timeout values in Configuration File
# 1  
Old 11-20-2011
Script to increase Timeout values in Configuration File

Hi Guys
I am using one configuration file for reading some time out values.The format of the file is
Code:
A.Type = Number
A.Val = 2000
B.Type = Number
B.Val = 4000

Now my requirement is I need to write a shell script in Solaris where i need to increase these timeout values by 10 times of current values.

As follows
Code:
A.Type = Number
A.Val = 20000
B.Type = Number
B.Val = 40000

awk sub or awk gsub commands are not working in Solaris

Last edited by Scott; 11-20-2011 at 02:24 PM.. Reason: Code tags...
# 2  
Old 11-20-2011
When in solaris, always use nawk or use /usr/xpg4/bin/awk
Code:
awk -F= '/Val/{$NF=$NF*10}1' input_file

--ahamed

Last edited by ahamed101; 11-20-2011 at 02:20 PM..
# 3  
Old 11-20-2011
Quote:
Originally Posted by ahamed101
When in solaris, always use nawk or use /usr/xpg4/bin/awk
Code:
awk -F= '/Val/{$NF=$NF*10}1' input_file

--ahamed
Your command is working but its printing as follows
Code:
awk -F= '/Val/{ $NF= $NF*10 } {print $0 } ' test.cfg


A.Type = Number
A.Val  20000
B.Type = Number
B.Val  40000


Last edited by Scott; 11-20-2011 at 03:07 PM.. Reason: Code tags!
# 4  
Old 11-20-2011
Provided there are always spaces between the equal sign and the value, you can drop the -F option:

Code:
awk  '/Val/{$NF=$NF*10}1' input-file

Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Reading XML file and print the values in the text file using Linux shell script

hi guys, i want help... Reding XML file and print the values into the text file using linux shell script file as per below xml file <sequence> <Filename>aldorzum.doc</Filename> <DivisionCode>US</DivisionCode> <ContentType>Template</ContentType> <ProductCode>VIMZIM</ProductCode> </sequence>... (1 Reply)
Discussion started by: sravanreddy
1 Replies

2. UNIX for Dummies Questions & Answers

Issue with use of Configuration file instead of hardcoded values inside the script

Hi, My code works perfectly fine. But, $my $min_to_add = 1 * 1 * 60; and my $hr_to_sub = 1 * 1 * 86400; i may need to change the values in future. so am keeping them in a separate configuration file like MIN = 1 * 1 * 60 HR = 24 * 60 * 60 in the script, i use a package use et_config... (3 Replies)
Discussion started by: irudayaraj
3 Replies

3. Shell Programming and Scripting

extracting values from configuration file

Dear All, i am new to shell scripting, I am working on embedded system based on linux.I am supposed to the read the configuration file and edit another file. presently I would like to read from the configuration file.It would be having values file one below. There is chance of entering... (6 Replies)
Discussion started by: Ratheendran
6 Replies

4. AIX

To increase timeout for connect function

Hi All, Is there any way to increase the timeout of connect() function. Kindly provide me some information on configuring the TCP/IP timeout period, used during the AIX 'connect()' function call. Thanks SP (1 Reply)
Discussion started by: saraperu
1 Replies

5. Red Hat

wireless interface timeout configuration

Hello, I have a small desktop running RedHat 5. Depending where I'm at, it connects to the network by a wireless interface or a wired interface. If I'm in an are where there is no wireless network, the box hangs on boot up. It will not timeout and move on. It just hangs. Is there a timeout... (0 Replies)
Discussion started by: garskoci
0 Replies

6. Shell Programming and Scripting

Shell script that reads from configuration file to get database

Hi intelligent beings, I am trying to write a script that 1. Accepts the following arguments: store_number div_number user_id div_code 2. Will read from a configuration file to get the Database 3. Use the div_code to determine which value to retrieve from the configuration file ... (1 Reply)
Discussion started by: dolo21taf
1 Replies

7. Shell Programming and Scripting

How to read the configuration file from shell script

Hello all, Please let me know if anyone have the idea how to read the configuration file from the shell script? Thanks in advance, Nishanth (7 Replies)
Discussion started by: nishanth hampal
7 Replies

8. Solaris

increase ftp timeout

Dear Experts How is it possible to increase the ftp timeout. After 900 seconds my ftp connection from my PC to a Solaris 8 U60 Workstation is lost due to timeout limitation i guess on the workstation side. Very Best regards Reza (1 Reply)
Discussion started by: Reza Nazarian
1 Replies

9. Shell Programming and Scripting

script to read configuration file

Hi, I would like to write a Korn shell script which will remove files older than a certain date. In my script, it will read a configuration file with the following entries: # <directory> <filename wildcard> # /home/philip/log *.log /home/philip/log1 delete-me*.log The... (1 Reply)
Discussion started by: philip_dba
1 Replies
Login or Register to Ask a Question