The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
modifying grep to return latest files ragha81 Shell Programming and Scripting 5 04-02-2009 11:16 AM
.bashrc files modifying the PS1 variable? raidkridley Shell Programming and Scripting 5 11-10-2008 10:54 AM
Modifying command for Tar.gz Files. openspark Shell Programming and Scripting 2 08-28-2008 05:53 PM
modifying grep to get files only within last 2 hrs ragha81 Shell Programming and Scripting 3 01-11-2007 07:11 PM
How can I ... (Modifying large ASCII files) hviktor UNIX for Dummies Questions & Answers 2 07-20-2001 10:28 AM

Reply
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 07-06-2009
xyzt xyzt is offline
Registered User
  
 

Join Date: Apr 2008
Posts: 21
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:

Code:
for f in $( find . -name "*.xml" ); do sed -n "s/<idle>600<\/idle>/<idle>900<\/idle>/p" $f >> $f;   echo "file:" $f;done
by the way, I use Linux sed, not Unix sed.(I'm not sure if differs)

thanks in advance...
  #2 (permalink)  
Old 07-06-2009
fpmurphy's Avatar
fpmurphy fpmurphy is offline Forum Staff  
Moderator
  
 

Join Date: Dec 2003
Location: Florida
Posts: 1,913
The problem is with this line. You cannot send the output of GNU sed to itself.
Code:
sed -n "s/<idle>600<\/idle>/<idle>900<\/idle>/p" $f >> $f
You could use the -i option to edit it in place. man sed for more information.
Reply

Bookmarks

Tags
sed, xml

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:01 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0