![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| 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 |
| How to hide command line parameters? | xyzt | UNIX for Advanced & Expert Users | 6 | 08-31-2009 07:31 PM |
| Reading putty command line parameters from Linux | SFNYC | UNIX for Advanced & Expert Users | 1 | 04-15-2009 10:17 PM |
| How to use parameters in command line while submitting a report | sreenusola | UNIX for Dummies Questions & Answers | 1 | 09-17-2008 02:48 PM |
| How do you take in variables/parameters from the command line? | avisram | UNIX for Dummies Questions & Answers | 1 | 07-21-2005 09:47 AM |
| passing command line parameters to functions - sh | vino | Shell Programming and Scripting | 5 | 03-05-2005 05:51 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Want to use sed to add some parameters at the end of the line
Hello All,
I have a doubt in sed, i want to add some parameter at the end of the tag inside a xml tag. how to i do that. so i want to add Results="true" value="high" inside the xml tag. Orignal <execute description="reboot"> <execute description="Stop Servlet"> After adding the parameters:- <execute description="reboot" Results="true" value="high"> <execute description="Stop Servlet" Results="true" value="high"> How do i do that. Thanks Adsi Last edited by asirohi; 4 Weeks Ago at 04:39 PM.. |
|
||||
|
This does not changes the things inside the xml file permanently. It just print the changes in the Command line. What changes should i make.I am enclosing my script below, when i pass the xml file to be modified from the command line.
Code:
#!/bin/sh
usage() {
$ECHO "Usage: [not perfect]"
}
if [ $# -eq 0 ]; then
usage
exit 0
fi
cat $1 | grep "execute description=" | sed 's/>/ Results="true" value="h
igh">/'
if [ $# -ne 1 ];
then
usage
exit 1
fi
|
|
||||
|
Oops, that was a dumb question, that worked but xml file now just has:-
<execute description="reboot" Results="true" value="high"> <execute description="Stop Servlet" Results="true" value="high"> where as it should be:- <?xml version="1.0" encoding="UTF-8"?> <start> <execute description="reboot" Results="true" value="high"> <execute description="Stop Servlet" Results="true" value="high"> </start> How could i fix this? Thanks Adsi |
|
|||||
|
Quote:
|
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|