03-05-2008
Config File example
[Billing]
LocalIPAddress = 192.168.1.116
ProcessorsNumber = 1
[Plugins]
LocalIPAddress = 192.168.2.116
ProcessorsNumber = 2
[Statistics]
LocalIPAddress = 192.168.3.116
ProcessorsNumber = 1
I manage to read like this:
BILLPROCESSORSNUMBER=`grep -m1 '^[^#][:space:]*ProcessorsNumber' $OLD_CFG | awk -F" = " '{print $2}' |tail -1`
PLUGINPROCESSORSNUMBER=`grep -m2 '^[^#][:space:]*ProcessorsNumber' $OLD_CFG | awk -F" = " '{print $2}' |tail -1`
STATPROCESSORSNUMBER=`grep -m3 '^[^#][:space:]*ProcessorsNumber' $OLD_CFG | awk -F" = " '{print $2}' |tail -1`
But I'm worried if the sections in the config file will switch and the order not preserved ... then the grep -mX and tail will not give me the proper value for the section/parameter I want.
I want to read this values and later to write them back in the new config file with:
sed -e "/\[Billing\]/,/^[^#][:space:]*ProcessorsNumber =/ s-\(^[^#][:space:]*ProcessorsNumber = \)\([^#]*\)-\1$BILLPROCESSORSNUMBER-1" \
This sed works.
So it is alll about how to read correct from the file.
Thanks
Bianca
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi All,
I have problem with database validations, actually my requirement is, my code will generate some seqno;s, which i have to check in database, whether the generated seqno;s are present in database or not, if the generated seqno;s are present in the database means, i need to generate... (2 Replies)
Discussion started by: hsekol
2 Replies
2. UNIX for Advanced & Expert Users
I have a file that I need to parse multiple sections from the file.
The file contains multiple lines that start with ST (Abunch of data)
Then the file contains multiple lines that start with SE (Abunch of data)
SE*30*0001 ... (1 Reply)
Discussion started by: rgentis
1 Replies
3. Shell Programming and Scripting
I have a file that I need to parse multiple sections from the file.
The file contains multiple lines that start with ST (Abunch of data)
Then the file contains multiple lines that start with SE (Abunch of data)
SE*30*0001
ST*810*0002
I need all of the lines between and including these.... (6 Replies)
Discussion started by: rgentis
6 Replies
4. Shell Programming and Scripting
I have a FILE a.txt which has the following data
113901.94,113901.94,56950.97,56950.97,NOT MATCHING,NOT MATCHING
10693.04,10693.04,5346.52,5346.52,NOT MATCHING,NOT MATCHING
1901.94,1901.94,550.97,550.97,NOT MATCHING,NOT MATCHING
103.04,103.04,53.52,53.52,NOT MATCHING,NOT MATCHING
#### This... (2 Replies)
Discussion started by: ksmbabu
2 Replies
5. Shell Programming and Scripting
Hello,
I'm wondering where I could go to learn how to edit file sections that cross multiple lines. I'm wanting to write scripts that will add Gnome menu entries for all users on a system for scripts I write, etc. I can search an replace simple examples with sed, but this seems more complex.
... (8 Replies)
Discussion started by: Narnie
8 Replies
6. UNIX for Dummies Questions & Answers
So, I'm going to install Oracle DB within my Suse host...
Also, I would like to run Virtual Box and Tomcat..
ok, tomcat is going to be runnable app that will start at boot..
but, how to handle Oracle and virtual box?
I would like to have an Oracle under it's own user, and to be able to use... (0 Replies)
Discussion started by: bongo
0 Replies
7. Shell Programming and Scripting
Hi Team,
In our project we have written below 2 scripts like
Script1:
Shell script start & END
Begin Audit process - uses teradata bteq
END Audit Process
Script 2: Environemtal variable file different
Now Client ask to change this requirement and need below files:
Script1:... (1 Reply)
Discussion started by: tusharzaware1
1 Replies
8. UNIX for Advanced & Expert Users
Hi,
I noticed a weird behavior in extundelete way to choose the filename to which it will restore a given inode. Here is an example :
root@rescue:~# for after in '' 0 740 741 $(date -d 'now - 1 year' +%s); do rm -rf RECOVERED_FILES/; echo -e "$(date -d@$after 2> /dev/null || echo No... (4 Replies)
Discussion started by: chebarbudo
4 Replies
9. Shell Programming and Scripting
Dear Team Members,
I have a unique problem. Below is the dataset which I have. I am writing a script which will read through the file and pull the invoice no. (Field 2 of C1 row).
"C1",990001,"L1","HERO","MOTORCYCLE","ASIA-PACIFIC","BEIJING"
"C2","CLUTCH","HYUNDAI",03032017... (13 Replies)
Discussion started by: chetanojha
13 Replies
10. Shell Programming and Scripting
Hello All,
I want to change date part in file name to yesterday date in the file name.
example file name file-12122017-06-30-41.dat want file-12112017-06-30-41.dat I am doing like below. Below it is not changing the filename. Actually it is not parsing the $today and $yesterday value in... (1 Reply)
Discussion started by: looney
1 Replies
LEARN ABOUT OSF1
dhcpparm
dhcpparm(8) System Manager's Manual dhcpparm(8)
NAME
dhcpparm - Daemon for client configuration
SYNOPSIS
/usr/sbin/dhcpparm [-i interface] tag | symbol | name
OPTIONS
Use this option on hardware that has two or more interfaces configurable by the Dynamic Host Configuration Protocol (DHCP), and for a
parameter that is interface specific. When no interface is specified, the client daemon returns the name of the first interface it finds on
which DHCP has successfully completed: the value(s) displayed will be those of the configuration received on that interface.
DESCRIPTION
The dhcpparm command displays the value(s) of the parameter requested on the command line as supplied by the DHCP protocol. If the DHCP
parameter implies more than one value (for example, a list of gateways), the values are displayed separated by newline characters. The
parameter may be identified either by its numeric value in the DHCP protocol, by its two character symbol, or by its long name. The dhcp-
parm command is intended to be used in command substitutions in the shell scripts invoked by init at system boot. It first contacts the
DHCP client daemon (joinc) to verify that DHCP has successfully completed. When the -i option specifies a particular interface, the daemon
verifies successful DHCP configuration of that interface; otherwise, the client verifies that at least one interface is successfully con-
figured, and supplies the name of that interface to dhcpparm. Parameter values echoed by dhcpparm should not be used without checking exit
status. See the EXIT STATUS section below.
RESTRICTIONS
A cluster member should never be a DHCP client; it should always use static addressing.
If a cluster is to support a DHCP server, there can only be one DHCP server for all the cluster members using a common database with
failover.
If a cluster is to support a DHCP server, there can only be one DHCP server for all the cluster members using a common database with
failover.
DHCP client is not supported on dataless clients.
SYMBOLS
See dhcptags(4) for the list of two letter symbol codes and names of all DHCP parameters. See RFC 1533 for more detail.
EXIT STATUS
Exit codes are as follows: Success. DHCP was not successful. The DHCP client daemon may not be running, the interface might have failed to
configure, or no satisfactory DHCP responses were received. Bad arguments. A timer was set and the interface had not configured before it
expired. Can only be run as root. Some system error (should never occur).
SEE ALSO
Commands: dhcpconf(8), joinc(8), showdhc(8), shleases(8)
Files: client.pcy(4), dhcptags(4)
RFC1533
dhcpparm(8)