Replacing text inside xmltag


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Replacing text inside xmltag
# 1  
Old 11-08-2009
Replacing text inside xmltag

Hi All-

I have a xml file with tag

Code:
<Forename>ABCDEF</Forename>
<Surname>ABCDEFGH</Surname>

in between tag it could be anything I need to search
Code:
<Forename></Forename>

and change what ever there in between

Regards,
Sreejit
# 2  
Old 11-08-2009
Is this you are looking for ?

Code:
sed 's@<\(Forename\)>\(.*\)</\1>@<\1></\1>@' t1


-- t1 is the file name which has the given content.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Replacing values inside a file.

Good day guys, I'm having trouble in creating a logic when it comes to replacing the values inside a file. I tried using sed command but it just doesn't work the way I want it to be. Here is what I'm trying to achieve. If my input file contains the values below. NAME++GUEST1 ++GUESS2++... (3 Replies)
Discussion started by: asdfghjkl
3 Replies

2. Shell Programming and Scripting

Finding the pattern and replacing the pattern inside the file

i have little challenge, help me out.i have a file where i have a value declared and and i have to replace the value when called. for example i have the value for abc and ccc. now i have to substitute the value of value abc and ccc in the place of them. Input File: go to &abc=ddd; if... (16 Replies)
Discussion started by: saaisiva
16 Replies

3. Shell Programming and Scripting

Replacing part of XML code inside comment tags

Hello! I'd like to modify custom values in a XML config file between comment tags using bash script. <feature> <keyboardshortcut>C-m</keyboardshortcut> <option1>disabled</option2> <option2>enabled</option2> </feature> <!-- bash script features START --> <feature> ... (2 Replies)
Discussion started by: prism1
2 Replies

4. Shell Programming and Scripting

Replacing Comma delimiter coming inside the data.

Hello, I am having flat file (Comma Delimiter) and the data in the file is as given below. EMPNO, ENAME, DESIGNATION, SALARY 10979, Arun Kumar, Cosultant, 35000 13555, Bidhu Shekar, Senior Consultant, 45000 15000, Kiran, Kumar, Senior, Consultant, 40000 If... (9 Replies)
Discussion started by: arunvasu2
9 Replies

5. Shell Programming and Scripting

CSV: Replacing multiple occurrences inside a pattern

Greatings all, I am coming to seek your knowledge and some help on an issue I can not currently get over. I have been searching the boards but did not find anything close to this matter I am struggling with. I am trying to clean a CSV file and make it loadable for my SQL*Loader. My problem... (1 Reply)
Discussion started by: OCanada
1 Replies

6. Shell Programming and Scripting

Help with replacing tabs inside "" with some text/blank

I am poor with scripting;) I have a file in the following format; 'This is a "test in production" of importance.' I want to get rid of the spaces inside the "" part only to get the output as, 'This is a "testinproduction" of importance.' (1 Reply)
Discussion started by: shmathew
1 Replies

7. Shell Programming and Scripting

Need help in sed command ( Replacing a pattern inside a file with a variable value )

Hello, The following sed command is giving error sed: -e expression #1, char 13: unknown option to `s' The sed command is echo "//-----" | sed "s/\/\/---*/$parChk/g" where parChk="//---ee-" How can i print the variable value from sed command ? And is it possible to replace a... (2 Replies)
Discussion started by: frozensmilz
2 Replies

8. Shell Programming and Scripting

Replacing Text in Text file

Hi Guys, I am needing some help writing a shell script to replace the following in a text file /opt/was/apps/was61 with some other path eg /usr/blan/blah/blah. I know that i can do it using sed or perl but just having difficulty writing the escape characters for it All Help... (3 Replies)
Discussion started by: cgilchrist
3 Replies

9. Shell Programming and Scripting

replacing a number with random variable inside shell script

Hi All. I need help for the below logic. I ve a file like following input file: NopTX(5) // should be remain same as input ----Nop(@100); //1 Nop(90); //2 --Nop(80); //3 @Nop(70); //4 --@Nop(60); //5 @Nop@(@50); //6 --Nop@( 40); ... (3 Replies)
Discussion started by: user_prady
3 Replies

10. UNIX for Advanced & Expert Users

Replacing text inside a directory

This is my first post to this group.I am new to Unix.I have one requirement I need to replace a text in all the files in a directory and sub-directory.Eg i have a folder structure like /usr/local/abc , inside abc i have several directories and several files. All the files inside abc and all the... (1 Reply)
Discussion started by: vatsan
1 Replies
Login or Register to Ask a Question