02-09-2009
Replacement of text in a file
Hi ,
I have some data in my file(properties.txt) like this.
# agent.properties
agent.dmp.Location=
agent.name=
I need to relpace the
agent.dmp.location with agent.dmp.Location = /opt/VRTS/vxvm
I am using the follwing to replace the string
AGENT_NAME=snmp
AGENT_DMP_LOCATION=/var/opt
sed "s/agent.name=.*/agent.name= $AGENT_NAME/g" properties.txt > properties.txt.tmp;
mv properties.txt.tmp properties.txt > /dev/null 2>&1
the above command is successfully executing and the value in the file is
# agent.properties
agent.dmp.Location=snmp
agent.name=
but for agent.dmp.Location
sed "s/agent.dmp.Location=.*/agent.dmp.Location= $AGENT_DMP_LOCATION/g" properties.txt > properties.txt.tmp;
mv properties.txt.tmp properties.txt > /dev/null 2>&1
is showing error like this
sed: command garbled: s/agent.dmp.Location =.*/agent.dmp.Location= /var/opt/g
i think the problem is due the variable AGENT_DMP_LOCATION=/var/opt..since it has '/' .
could anyone please solve this issue.
thanks in advance.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi group,
I want to replace the occurance of a particular text in a paragraph.I tried with Sed,but Sed only displays the result on the screen.How can i update the changes in the original file???
The solution should be a one liner using awk and sed.
Thanks in advance. (5 Replies)
Discussion started by: bishnu.bhatta
5 Replies
2. UNIX for Dummies Questions & Answers
I have 2 files that are tab dilimiter:
file1 contains:
T 1 2 3 1000
T 5 10 15 9000
T 4 5 6 2000
T 3 7 9 6000
AND SO ON
file2 contains: (columns number 1, 2, and 3 are match-pattern to file1)
1 2 3 JOHN
4 4 4 MIKE
4 5 6 TOM
3 7 9 MIKE
AND SO ON
I want file3 contains... (3 Replies)
Discussion started by: bobo
3 Replies
3. UNIX for Dummies Questions & Answers
Hi,
Im trying to find and replace text within a unix file using sed.
The command that i have been using is
sed '/,null,/ s//, ,/g' result.txt>result.tmp
for replacing ",null," with ", ,".
But this only replaces the first occurrance of ,null, in every line. I want to do it globally.
It... (7 Replies)
Discussion started by: sohaibs
7 Replies
4. Shell Programming and Scripting
Dear all, will be grateful for your advices..
The need is (i guess) simple for UNIX experts. Basically, there are replacement tables, which would be used to replace text strings in the data (large volumes..).
An exmpl table (a "config file"):
VIFIS1_1_PE1836 VIBRIO_FISCHERI
VIPAR1_1_PE1662 ... (7 Replies)
Discussion started by: roussine
7 Replies
5. UNIX for Dummies Questions & Answers
I have a string of letters. (They happen to be DNA, not that it's relevant to the question.) For analysis purposes, I need to replace the information at some of the sites. I need to do this based on their position, not the information in that position.
I also need to ignore differences at other... (10 Replies)
Discussion started by: JFS
10 Replies
6. Shell Programming and Scripting
Hi,
I have a requirement in which i need to replace text as below -
<stringProp name="Recipe"><AddGroup Name="1001" Path="ServiceAdministration/Controls/1001/ServiceSwitches">
<Param Name="AttributeName" Value="HeaderManipRspIngressRuleSet" Type="String" />
<Param Name="Value"... (0 Replies)
Discussion started by: abhitanshu
0 Replies
7. Shell Programming and Scripting
Hello scriping expert friends,
I have 2 requirements on replacing fields of text files:
I have lot of data with contents like below:
Requirement-1:
The digit after 0 should always be changed to 1 (3 Replies)
Discussion started by: magnus29
3 Replies
8. Shell Programming and Scripting
Hi guys,
I worked for almost a half-day for the replacement of some text automatically with script. But no success.
The problem is I have hundred of files, which need to be replaced with some new text. It's a painful work to work manually and it's so easy to do it wrong.
For example,
I... (2 Replies)
Discussion started by: liuzhencc
2 Replies
9. Shell Programming and Scripting
Hi all,
Saying we have two files:
1. A "Reference File" whose content is "Variable Name": "Variable Value"
2. A "Model File" whose content is a model program in which I want to substitute "VariableName" with their respective value to produce a third file "Program File" which would be a... (4 Replies)
Discussion started by: dae
4 Replies
10. Shell Programming and Scripting
Hello,
I'm using Bash and Sed to replace text within a text file (1.txt) twice in one script. Using a for loop I'm initially replacing any 'apple' words with the variable 'word1' ("leg). I'm then using another for loop to replace any 'apple' words with the variable 'word2' ("arm"). This task is... (2 Replies)
Discussion started by: Flip-Flop
2 Replies
LEARN ABOUT LINUX
snmpa_supervisor
snmpa_supervisor(3erl) Erlang Module Definition snmpa_supervisor(3erl)
NAME
snmpa_supervisor - A supervisor for the SNMP agent Processes
DESCRIPTION
This is the top supervisor for the agent part of the SNMP application. There is always one supervisor at each node with an SNMP agent (mas-
ter agent or sub-agent).
EXPORTS
start_sub_sup(Opts) -> {ok, pid()} | {error, {already_started, pid()}} | {error, Reason}
Types Opts = [opt()]
opt() = {db_dir, string()} | ...
Starts a supervisor for the SNMP agent system without a master agent. The supervisor starts all involved SNMP processes, but no
agent processes. Sub-agents should be started by calling start_sub_agent/3 .
db_dir is mandatory.
See configuration parameters for a description of the options.
start_master_sup(Opts) -> {ok, pid()} | {error, {already_started, pid()}} | {error, Reason}
Types Opts = [opt()]
opt() = {db_dir, string()} | {config, ConfOpts()} | ...
ConfOpts = [conf_opts()]
conf_opts() = {dir, string()} | ...
Reason = term()
Starts a supervisor for the SNMP agent system. The supervisor starts all involved SNMP processes, including the master agent. Sub-
agents should be started by calling start_subagent/3 .
db_dir is mandatory.
dir in config is mandatory.
See snmp config for a description of the options.
start_sub_agent(ParentAgent,Subtree,Mibs) -> {ok, pid()} | {error, Reason}
Types ParentAgent = pid()
SubTree = oid()
Mibs = [MibName]
MibName = [string()]
Starts a sub-agent on the node where the function is called. The snmpa_supervisor must be running.
If the supervisor is not running, the function fails with the reason badarg .
stop_sub_agent(SubAgent) -> ok | no_such_child
Types SubAgent = pid()
Stops the sub-agent on the node where the function is called. The snmpa_supervisor must be running.
If the supervisor is not running, the function fails with the reason badarg .
Ericsson AB snmp 4.19 snmpa_supervisor(3erl)