xml code in bash shell


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting xml code in bash shell
# 1  
Old 01-06-2009
xml code in bash shell

Hi,

I am trying to develop a bash script that contains an xml code. I want to put the xml code inside the bash script. Is there a way to make that happen?!

My goal is to create a script that can allow the user to enter some parameters which can be passed by the script to the xml code Smilie .

Kindly advise ..

Thank you,, Smilie
# 2  
Old 01-06-2009
are you trying to accept some parameters from the user and put them in an XML file? that's possible. sed or perl would be of help.
# 3  
Old 01-06-2009
Quote:
Originally Posted by Yogesh Sawant
are you trying to accept some parameters from the user and put them in an XML file? that's possible. sed or perl would be of help.
Hi Yogesh,

Thanks for responding, Smilie

Yes, I am trying to do that. But the xml code is not separated. To be more specific:

What I am trying to do is to put the xml code in a sub function or a message that can be called later in the script, as the following:

Code:
#! /bin/bash


message= "POST /Servername HTTP/1.1
User-Agent: Admin
Host: localhost
Authorization: Basic <authentication>
Content-Type: text/xml
Content-Length: 915

<?xml version="1.0"?>

...

<...>"


# To run the xml code:
$message | telnet 0 10010

The problem is that after the telnet is done the XML request is not seen by the server.

Can you please explain how I can use the perl or sed?


Thanks again !
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to pull multiple XML tags from the same XML file in Shell.?

I'm searching for the names of a TV show in the XML file I've attached at the end of this post. What I'm trying to do now is pull out/list the data from each of the <SeriesName> tags throughout the document. Currently, I'm only able to get data the first instance of that XML field using the... (9 Replies)
Discussion started by: hungryd
9 Replies

2. Shell Programming and Scripting

Shell Script Comment code blocks in a bash source file

Just began to learn on Shell Script. I got an exercise from my friend. I know how to make this happen in C, but I'm not familiar with Shell Script. Hope I can get some help from all of you. I want to write a bash script to comment code blocks in a bash source file. What I mean comment is '#', I... (1 Reply)
Discussion started by: HiFuture0801
1 Replies

3. Shell Programming and Scripting

How to add Xml tags to an existing xml using shell or awk?

Hi , I have a below xml: <ns:Body> <ns:result> <Date Month="June" Day="Monday:/> </ns:result> </ns:Body> i have a lookup abc.txtt text file with below details Month June July August Day Monday Tuesday Wednesday I need a output xml with below tags <ns:Body> <ns:result>... (2 Replies)
Discussion started by: Nevergivup
2 Replies

4. Shell Programming and Scripting

Shell Command to compare two xml lines while ignoring xml tags

I've got two different files and want to compare them. File 1 : HTML Code: <response ticketId="944" type="getQueryResults"><status>COMPLETE</status><description>Query results fetched successfully</description><recordSet totalCount="1" type="sms_records"><record... (1 Reply)
Discussion started by: Shaishav Shah
1 Replies

5. Shell Programming and Scripting

Shell script for XML code parsing.

I need to create a shell script that can parse the below XML and send a string back adding all XML values. The text which's not in angular braces are to be printed. Sample code: <RequestBillsRsp... (9 Replies)
Discussion started by: xtatic
9 Replies

6. Shell Programming and Scripting

Shell script for XML code parsing.

Please help me to create a shell script that can parse the below XML and send a string back adding all XML values.:) <RequestBillsRsp... (1 Reply)
Discussion started by: xtatic
1 Replies

7. Shell Programming and Scripting

HOW to run a bash-code in a c-shell script ??

Is there a way to run some code in a C-shell script by different shell, like bash? I have that situation. I have prepared and perfectly workable bash-skript that now I have to execute under C-shell script, divide it on steps and without creating a new files (with the bash-code parts.) For... (6 Replies)
Discussion started by: alex_5161
6 Replies

8. Shell Programming and Scripting

Bash XML Parsing using Perl XPath

I have a bash script that needs to read input from an XML file, which includes varying numbers of a certain type of child node. I want to be able to iterate through all the child nodes of a given parent. I installed the Perl XML-XPath package from search.cpan.org. Once it's installed, from bash,... (4 Replies)
Discussion started by: jfmorales
4 Replies

9. Shell Programming and Scripting

Need to Parse XML from bash script

I am completely new to bash scripting and now need to write a bash script that would parse a XML file and take out values from specific tags. I tried using xsltproc, xml_grep commands. But the issue is that the XML i am trying to parse is not UTF 8. so those commands are unable to parse my XML's... (4 Replies)
Discussion started by: shivashankar.g
4 Replies

10. Shell Programming and Scripting

How to remove xml namespace from xml file using shell script?

I have an xml file: <AutoData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <Table1> <Data1 10 </Data1> <Data2 20 </Data2> <Data3 40 </Data3> <Table1> </AutoData> and I have to remove the portion xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" only. I tried using sed... (10 Replies)
Discussion started by: Gary1978
10 Replies
Login or Register to Ask a Question