Sponsored Content
Top Forums Shell Programming and Scripting Shell Script to insert text after Tag Post 302857671 by tassomanoel on Thursday 26th of September 2013 10:14:22 PM
Old 09-26-2013
Shell Script to insert text after Tag

Hello,

I'm doing an Shell Script to insert a text on XML file, i tried sed, awk, perl... i'm doing something wrong, please help me Smilie

well, the script is a bit large, i get some infos on script before 'run' this part to insert the text on XML...

Code:
domobile() {
    let i++
    echo
    echo "${i}. Auto mobile stream install"
	sed 's/.*<StartupStreams>.*/&\n<StartupStream>
	<Application>$login/_definst_</Application>
	<MediaCasterType>shoutcast</MediaCasterType>
	<StreamName>$login.stream</StreamName></StartupStream>/' ${INSTALLDIR}/conf/StartupStreams.xml

}


basically, after the tag <StartupStream> i need to add these infos;

Code:
<StartupStream>
	<Application>$login/_definst_</Application>
	<MediaCasterType>shoutcast</MediaCasterType>
	<StreamName>$login.stream</StreamName>
        </StartupStream>

can you guys help me?
Moderator's Comments:
Mod Comment Please use CODE tags for multi-line code, input, and output samples; not ICODE tags.

Last edited by Don Cragun; 09-26-2013 at 11:57 PM.. Reason: Fix tags.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to remove some xml tag lines using shell script

I have existing XML file as below, now based on input string in shell script on workordercode i need to create a seprate xml file for e.g if we pass the input string as 184851 then it find the tag data from <workOrder>..</workOrder> and write to a new file and similarly next time if i pass the... (3 Replies)
Discussion started by: balrajg
3 Replies

2. UNIX for Advanced & Expert Users

Shell Script to read XML tags and the data within that tag

Hi unix Gurus, I am really new to Unix Scripting. Please help me to create a shell script which reads the xml file and from that i need to fetch a particular information. For example <SOURCE BUSINESSNAME ="" DATABASETYPE ="Teradata" DBDNAME ="DWPROD3" DESCRIPTION ="" NAME... (2 Replies)
Discussion started by: SmilePlease
2 Replies

3. Shell Programming and Scripting

How can I remove some xml tag lines using shell script?

Hi All, My name is Prathyu and I am working as a ETL develper. I have one requirement to create a XML file based on the provided XSD file. As per the Datastage standards Key(repeatable) field does not contain any Null values so I am inserting some dummy tag line to that XML file. ... (14 Replies)
Discussion started by: Prathyu
14 Replies

4. Shell Programming and Scripting

Modify XML tag using shell script

Hi All Need some help with a unix shell script. I have a XML file as shown below: <Root> <Service> <endPoint type="SOAP" protocol="http"> <provider>ABCD</provider> <urlRewrite>/service/xyz/getAccountDetails</urlRewrite> <timeout>30</timeout> </endPoint> </Service> <Service> <endPoint... (3 Replies)
Discussion started by: abhilwa
3 Replies

5. Shell Programming and Scripting

awk command to insert a tag in XML

Hi All, I need a help on inserting a XML tag. Actual input <var> <nam>abcd</nam> <a1>.</a1> </var> if tag <a1>.</a1> is getting missed in XML like below <var> <nam>abcd</nam> </var> i need to insert wherever it is missed after <nam> tag and before </var> tag. Could anyone... (3 Replies)
Discussion started by: mohanalakshmi
3 Replies

6. UNIX for Dummies Questions & Answers

Insert text into a file using shell script

Hi, I need to insert "Hello World" text into a file called hai.txt using shell scripting. Kindly help me. For eg: If I open the file hai.txt by giving linux command cat hai.txt, the content of the file should have the text Hello World in it. Thanks (5 Replies)
Discussion started by: karthick nath
5 Replies

7. Shell Programming and Scripting

Print a closing XML tag shell script

I have a shell script that does everything I need it to do. But, when I was testing it I realized it doesn't print the closing XML tag.... Does anyone know how to incorporate printing the XML tag with my script? I am using AWK any help would be appreciated. (4 Replies)
Discussion started by: risarose87
4 Replies

8. Shell Programming and Scripting

Read xml tags and then remove the tag using shell script

<Start> <Header> This is header section </Header> <Body> <Body_start> This is body section <a> <b> <c> <st>111</st> </c> <d> <st>blank</st> </d> </b> </a> </Body_start> <Body_section> This is body section (3 Replies)
Discussion started by: RJG
3 Replies

9. Shell Programming and Scripting

How to insert a CSV within xml element tag using Python?

Hi Team, I have a CSV file which I have to read through and needs to insert the content within an XML file using Python ONLY ( as most of the code base we have in python only). I managed to find the first part, missing how to insert to XML under "specific" tags. cat input.csv... (0 Replies)
Discussion started by: panyam
0 Replies

10. UNIX for Beginners Questions & Answers

Multiline html tag parse shell script

Hello, I want to parse the contents of a multiline html tag ex: <html> <body> <p>some other text</p> <div> <p class="margin-bottom-0"> text1 <br> text2 <br> <br> text3 </p> </div> </body> (15 Replies)
Discussion started by: SorcRR
15 Replies
TELNETLOGIN(8)						    BSD System Manager's Manual 					    TELNETLOGIN(8)

NAME
telnetlogin -- login wrapper for telnetd SYNOPSIS
telnetlogin [-h host] [-p] [-f username] [username] DESCRIPTION
telnetlogin is a setuid wrapper that runs login(1). It is meant to be invoked by telnetd(8); the idea is to remove the necessity of running telnetd as root. telnetlogin should be installed mode 4750, user root, group telnetd. Then, telnetd may be run from /etc/inetd.conf as user ``nobody'', group ``telnetd'', and with the option -L path-to-telnetlogin. telnetlogin accepts only the subset of options to login(1) shown above, in the order listed. This is the order telnetd 8 normally provides them in. telnetlogin also does sanity checks on the environment variables TERM, and REMOTEHOST. It also insists that the standard input, output, and error streams are open on a terminal, and that it is the process group leader of the foreground process of that terminal. After checking all of these conditions, checking the values of the above environment variables for reasonable values, resetting signal handlers, and so forth, it execs login. SEE ALSO
login(1), inetd.conf(5), inetd(8), telnetd(8) RESTRICTIONS
THIS IS PRESENTLY EXPERIMENTAL CODE; USE WITH CAUTION. HISTORY
telnetlogin was written during the development of NetKit 0.17. Linux NetKit (0.17) April 12, 2000 Linux NetKit (0.17)
All times are GMT -4. The time now is 03:22 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy