using sed with xml files part 2


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting using sed with xml files part 2
# 1  
Old 03-20-2006
using sed with xml files part 2

I'm trying to replace a date in an XML file that has the format mm/dd/yyyy. I'm using the Unix date function to set up a variable with the current date but, when I try to replace the value in the XML file, the error message says it cannot be parsed. Here is the command I'm using

s_\(<service_date>\)[0-9/]*\(<\/service_date>\)_\1'$service'\2_

I would really appreciate any help - thanks
# 2  
Old 03-21-2006
Code:
s_\(<service_date>\)[0-9]\{2\}/[0-9]\{2\}/[0-9]\{4\}\(</service_date>\)_\1$service\2_g

# 3  
Old 03-21-2006
Thanks

Thanks for your help vino - I really appreciate it
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Splitting a single xml file into multiple xml files

Hi, I'm having a xml file with multiple xml header. so i want to split the file into multiple files. Sample.xml consists multiple headers so how can we split these multiple headers into multiple files in unix. eg : <?xml version="1.0" encoding="UTF-8"?> <ml:individual... (3 Replies)
Discussion started by: Narendra921631
3 Replies

2. Shell Programming and Scripting

Splitting xml file into several xml files using perl

Hi Everyone, I'm new here and I was checking this old post: /shell-programming-and-scripting/180669-splitting-file-into-several-smaller-files-using-perl.html (cannot paste link because of lack of points) I need to do something like this but understand very little of perl. I also check... (4 Replies)
Discussion started by: mcosta
4 Replies

3. Shell Programming and Scripting

Extract part of word from XML

Hi All, Can Someone help me in capturing a word from xml Using sed or awk or any other way in unix. i have file abc.xml like this <?xml version="1.0" encoding="ISO-8859-1" standalone="no" ?> - <NREC xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <HEADER> <SOURCE>MAIL</SOURCE>... (5 Replies)
Discussion started by: naveenkumarc
5 Replies

4. 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

5. Shell Programming and Scripting

How to extract part of xml line via awk?

Hi, I like to set a variable "name" automatically by reading an xml file. The name should be set to the date, which is a part of the following line of the xml file: <sceneID>C82_N32_A_SM_strip_008_R_2009-11-24T04:22:12.790028Z</sceneID> How can I separate this line, that the name will... (6 Replies)
Discussion started by: friend
6 Replies

6. Shell Programming and Scripting

how to extract part of xml line via awk?

Hi, I like to set a variable "name" automatically by reading an xml file. My code looks like this: set name = `awk '/<generationTime>/,/<\/generationTime>/ p' $xml_name` the "name" is thus set to <generationTime>2004-12-01T08:23:50.000000</generationTime> How can I separate this line,... (3 Replies)
Discussion started by: friend
3 Replies

7. Shell Programming and Scripting

modifying xml files using sed

Hello, I have lots of xml files in the same format and I need to modify a xml tag in these files. i loop over the files and apply sed to the files to make the modification but CPU goes to %100 while doing this. I think I'm doing something wrong. Here is my onliner: for f in $( find . -name... (1 Reply)
Discussion started by: xyzt
1 Replies

8. Shell Programming and Scripting

Need to cut a part of a XML file

I want to be able to search and remove a part of this file. For Example I want to make a search for something like Terminal.app and remove the following from the XML file. <dict> <key>GUID</key> <integer>210535539</integer> <key>tile-data</key> <dict> <key>dock-extra</key>... (9 Replies)
Discussion started by: elbombillo
9 Replies

9. Shell Programming and Scripting

Extracting a part of XML File

Hi Guys, I have a very large XML feed (2.7 MB) which crashes the server at the time of parsing. Now to reduce the load on the server I have a cron job running every 5 min.'s. This job will get the file from the feed host and keep it in the local machine. This does not solve the problem as... (9 Replies)
Discussion started by: shridhard
9 Replies

10. Shell Programming and Scripting

using sed with xml files

Hello I'm working on a project modifying XML files in Unix and, I would like to use sed to change these values. For example, I've got a tag <book>354678209<\book> and I want to replace the value 354678209 with a another value without having to go into the file and change it manually. How can I do... (3 Replies)
Discussion started by: stonemonolith
3 Replies
Login or Register to Ask a Question