Sponsored Content
Top Forums Shell Programming and Scripting Replacing part of XML code inside comment tags Post 302588324 by prism1 on Sunday 8th of January 2012 09:14:25 AM
Old 01-08-2012
Here you go:
Input:
Code:
<feature>
  <keyboardshortcut>C-m</keyboardshortcut>
  <option1>disabled</option2>
  <option2>enabled</option2>
</feature>
<!-- bash script features START -->
<feature>
  <keyboardshortcut>C-f</keyboardshortcut>
  <option1>enabled</option2>
  <option2>disabled</option2>
</feature>
<feature>
  <keyboardshortcut>C-g</keyboardshortcut>
  <option1>enabled</option2>
  <option2>enabled</option2>
</feature>
<!-- bash script features END -->

Output:
Code:
<feature>
  <keyboardshortcut>C-m</keyboardshortcut>
  <option1>disabled</option2>
  <option2>enabled</option2>
</feature>
<!-- bash script features START -->
<feature>
  <keyboardshortcut>C-f</keyboardshortcut>
  <option1>disabled</option2>
  <option2>disabled</option2>
</feature>
<feature>
  <keyboardshortcut>C-g</keyboardshortcut>
  <option1>enabled</option2>
  <option2>enabled</option2>
</feature>
<!-- bash script features END -->

 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

comment out a cron job as part of a script

Greetings, I am creating a ksh script to automate the installation of a utility on many servers. As part of this install, I want to check for a job in root's crontab. If the job exists, I need to comment it out. I know I will need to copy off the crontab then read it back in, but I am... (4 Replies)
Discussion started by: 22blaze
4 Replies

2. Shell Programming and Scripting

get rid of xml comment by grep or sed

Hi, I would like to get rid of all comment in an xml file by grep or sed command: The content seem like this: <!-- ab cd ef gh ij kl --> Anyone can help? Thanks and Regards (3 Replies)
Discussion started by: RonLii
3 Replies

3. Shell Programming and Scripting

Help using SED to comment XML elements

I'm trying to write a script to help automate some VERY tedious manual tasks. I have groups of fairly large XML files (~3mb+) that I need to edit. I need to look through the files and parse the XML looking for a certain flag contained in a field. If I find this flag (an integer value) I need... (4 Replies)
Discussion started by: J-Hon
4 Replies

4. Shell Programming and Scripting

Replacing some part of file

Hello, I have two files, consider that as file1 and file2. Here file1 is the master file. file1 will contain data like GS*RA*071000013*102562451P*091130*0520*334052023*X*003050 ST*820*334052023 BPR*C*509.77*C*ACH*CTX*01*071000013*DA*5529085*9000002008**01*071000013*DA*5529085*091130... (8 Replies)
Discussion started by: atlantis
8 Replies

5. Shell Programming and Scripting

Replacing the last record in xml with different tags

I have special requirement, my system provided the xml file as below(available xml file) and I need to convert it as below desired xml file. is it possible thru shell scripts or awk? What I need is : my available xml contains number of records with tags <RevenueAmounts>, the last of record is... (6 Replies)
Discussion started by: LinuxLearner
6 Replies

6. Shell Programming and Scripting

Script to put block comment after finding regex in xml file

hi, i need my bash script to find regex in xml file.. and comment 2 lines before and after the line that contains regex.. can't use # needs to be <!-- at the beginning and --> and the end of the comment. so eg.. first block <filter> <filter-name>MyRegEx</filter-name> ... (11 Replies)
Discussion started by: Poki
11 Replies

7. Shell Programming and Scripting

Replacing number between xml tags with ksh shell script

Hallo, im basically a complete noob on shell scripting and im trying to replace or rather add 1 to a number between xml tags. The xml basically has a tag somewhere that looks like this: <tag>12345678901234</tag> Now i want to replace the number between the tags. And i want the file to... (6 Replies)
Discussion started by: Demoric
6 Replies

8. Shell Programming and Scripting

Commenting a block of code in xml where the tags may be similar

I want to comment a block of code in xml. Note that the tags will be similar. In the below xml code, I want to block the listener block for com.pkg1.class2. How do i do it ? Thanks in Advance <listener> <listener-class>com.pkg1.class1</listener-class> </listener> ......... <listener>... (4 Replies)
Discussion started by: Lakshmikumari
4 Replies

9. UNIX for Dummies Questions & Answers

Replacing part of filename

Hi guys! I have quite a lot of files like all_10001_ct1212307460308.alf* and I want to get rid of the first number for all at once like: all_ct1212307460308.alf* How can I do this in the shell? (12 Replies)
Discussion started by: TimmyTiz
12 Replies
tnf_process_disable(3TNF)				       TNF Library Functions					 tnf_process_disable(3TNF)

NAME
tnf_process_disable, tnf_process_enable, tnf_thread_disable, tnf_thread_enable - probe control internal interface SYNOPSIS
cc [ flag ... ] file ... -ltnfprobe [ library ... ] #include <tnf/probe.h> void tnf_process_disable(void); void tnf_process_enable(void); void tnf_thread_disable(void); void tnf_thread_enable(void); DESCRIPTION
There are three levels of granularity for controlling tracing and probe functions (called probing from here on): probing for the entire process, a particular thread, and the probe itself can be disabled or enabled. The first two (process and thread) are controlled by this interface. The probe is controlled with the prex(1) utility. The tnf_process_disable() function turns off probing for the process. The default process state is to have probing enabled. The tnf_process_enable() function turns on probing for the process. The tnf_thread_disable() function turns off probing for the currently running thread. Threads are "born" or created with this state enabled. The tnf_thread_enable() function turns on probing for the currently running thread. If the program is a non-threaded program, these two thread interfaces disable or enable probing for the process. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWtnfd | +-----------------------------+-----------------------------+ |Interface Stability |Unstable | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ SEE ALSO
prex(1), tnfdump(1), TNF_DECLARE_RECORD(3TNF), TNF_PROBE(3TNF), attributes(5) NOTES
A probe is considered enabled only if: o prex(1) has enabled the probe AND o the process has probing enabled, which is the default or could be set with tnf_process_enable() AND o the thread that hits the probe has probing enabled, which is every thread's default or could be set with tnf_thread_enable(). There is a run time cost associated with determining that the probe is disabled. To reduce the performance effect of probes, this cost should be minimized. The quickest way that a probe can be determined to be disabled is by the enable control that prex(1) uses. There- fore, to disable all the probes in a process use the disable command in prex(1) rather than tnf_process_disable(). The tnf_process_disable() and tnf_process_enable() functions should only be used to toggle probing based on some internal program condi- tion. The tnf_thread_disable() function should be used to turn off probing for threads that are uninteresting. SunOS 5.10 5 Feb 2002 tnf_process_disable(3TNF)
All times are GMT -4. The time now is 07:17 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy