Shell script -adding XML tag to next line [on hold] The Next CEO of Stack OverflowHow to find and replace a particular string in a specific lineMaking A Shell Script To Write To XML FileHow to add an attribute in a tag in XML file by command-line?How to remove a line from a tag in shell script?alter a line and remove tag using perl from xml file?Shell Script: Want to delete two consecutive lines matching pattern from specific lineShell Script to extract the tag valueInsert custom XML tag into a XML file in a bash scriptAdding Numerical Suffixes to Tag-Names to Distinguish XML ElementsXML command line (shell script) manipulation

What happens if you roll doubles 3 times then land on "Go to jail?"

How to get regions to plot as graphics

Was a professor correct to chastise me for writing "Prof. X" rather than "Professor X"?

How can I quit an app using Terminal?

Anatomically Correct Strange Women In Ponds Distributing Swords

Increase performance creating Mandelbrot set in python

Can I equip Skullclamp on a creature I am sacrificing?

Go Pregnant or Go Home

Natural language into sentence logic

WOW air has ceased operation, can I get my tickets refunded?

Horror movie/show or scene where a horse creature opens its mouth really wide and devours a man in a stables

Should I tutor a student who I know has cheated on their homework?

Why didn't Theresa May consult with Parliament before negotiating a deal with the EU?

How to write papers efficiently when English isn't my first language?

Can a caster that cast Polymorph on themselves stop concentrating at any point even if their Int is low?

What is the purpose of the Evocation wizard's Potent Cantrip feature?

Are there languages with no euphemisms?

How can I get through very long and very dry, but also very useful technical documents when learning a new tool?

Why here is plural "We went to the movies last night."

If the heap is initialized for security, then why is the stack uninitialized?

What can we do to stop prior company from asking us questions?

Term for the "extreme-extension" version of a straw man fallacy?

How to safely derail a train during transit?

How do I solve this limit?



Shell script -adding XML tag to next line [on hold]



The Next CEO of Stack OverflowHow to find and replace a particular string in a specific lineMaking A Shell Script To Write To XML FileHow to add an attribute in a tag in XML file by command-line?How to remove a line from a tag in shell script?alter a line and remove tag using perl from xml file?Shell Script: Want to delete two consecutive lines matching pattern from specific lineShell Script to extract the tag valueInsert custom XML tag into a XML file in a bash scriptAdding Numerical Suffixes to Tag-Names to Distinguish XML ElementsXML command line (shell script) manipulation










-1















I am creating an XML file using shell script and output is coming as below.I want the <type> tag to come in new line



<?xml version="1.0" encoding="ABCCD"><type><members>ABC</members>
<members>ABC</members>
<name>ABC</name>
</type>
<type><members>system</members>
<name>ABC</name>
</type>
<version>XYZ</version>
</Package>


<?xml version="1.0" encoding="ABCCD">
<type>
<members>ABC</members>
<members>ABC</members>
<name>ABC</name>
</type>
<type>
<members>system</members>
<name>ABC</name>
</type>
<version>XYZ</version>
</Package>









share|improve this question









New contributor




user343859 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











put on hold as unclear what you're asking by Stephen Kitt, jimmij, nwildner, roaima, Mr Shunz 17 hours ago


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.













  • 4





    An XML parser would not care about the newline. Also, if you would want help with fixing an existing script, then it would be helpful to see the code of that script.

    – Kusalananda
    yesterday















-1















I am creating an XML file using shell script and output is coming as below.I want the <type> tag to come in new line



<?xml version="1.0" encoding="ABCCD"><type><members>ABC</members>
<members>ABC</members>
<name>ABC</name>
</type>
<type><members>system</members>
<name>ABC</name>
</type>
<version>XYZ</version>
</Package>


<?xml version="1.0" encoding="ABCCD">
<type>
<members>ABC</members>
<members>ABC</members>
<name>ABC</name>
</type>
<type>
<members>system</members>
<name>ABC</name>
</type>
<version>XYZ</version>
</Package>









share|improve this question









New contributor




user343859 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











put on hold as unclear what you're asking by Stephen Kitt, jimmij, nwildner, roaima, Mr Shunz 17 hours ago


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.













  • 4





    An XML parser would not care about the newline. Also, if you would want help with fixing an existing script, then it would be helpful to see the code of that script.

    – Kusalananda
    yesterday













-1












-1








-1








I am creating an XML file using shell script and output is coming as below.I want the <type> tag to come in new line



<?xml version="1.0" encoding="ABCCD"><type><members>ABC</members>
<members>ABC</members>
<name>ABC</name>
</type>
<type><members>system</members>
<name>ABC</name>
</type>
<version>XYZ</version>
</Package>


<?xml version="1.0" encoding="ABCCD">
<type>
<members>ABC</members>
<members>ABC</members>
<name>ABC</name>
</type>
<type>
<members>system</members>
<name>ABC</name>
</type>
<version>XYZ</version>
</Package>









share|improve this question









New contributor




user343859 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












I am creating an XML file using shell script and output is coming as below.I want the <type> tag to come in new line



<?xml version="1.0" encoding="ABCCD"><type><members>ABC</members>
<members>ABC</members>
<name>ABC</name>
</type>
<type><members>system</members>
<name>ABC</name>
</type>
<version>XYZ</version>
</Package>


<?xml version="1.0" encoding="ABCCD">
<type>
<members>ABC</members>
<members>ABC</members>
<name>ABC</name>
</type>
<type>
<members>system</members>
<name>ABC</name>
</type>
<version>XYZ</version>
</Package>






text-processing scripting xml






share|improve this question









New contributor




user343859 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




user343859 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited yesterday









Jeff Schaller

44.1k1161142




44.1k1161142






New contributor




user343859 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked yesterday









user343859user343859

1




1




New contributor




user343859 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





user343859 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






user343859 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




put on hold as unclear what you're asking by Stephen Kitt, jimmij, nwildner, roaima, Mr Shunz 17 hours ago


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.









put on hold as unclear what you're asking by Stephen Kitt, jimmij, nwildner, roaima, Mr Shunz 17 hours ago


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.









  • 4





    An XML parser would not care about the newline. Also, if you would want help with fixing an existing script, then it would be helpful to see the code of that script.

    – Kusalananda
    yesterday












  • 4





    An XML parser would not care about the newline. Also, if you would want help with fixing an existing script, then it would be helpful to see the code of that script.

    – Kusalananda
    yesterday







4




4





An XML parser would not care about the newline. Also, if you would want help with fixing an existing script, then it would be helpful to see the code of that script.

– Kusalananda
yesterday





An XML parser would not care about the newline. Also, if you would want help with fixing an existing script, then it would be helpful to see the code of that script.

– Kusalananda
yesterday










1 Answer
1






active

oldest

votes


















0














Try this,



 sed 's/><type>/>n<type>/g;s/<type></<type>n</g' file.xml


will search for the pattern ><type> then add a new line before the <type> and search for the pattern <type>< then add a new line after of <type>.



<?xml version="1.0" encoding="ABCCD">
<type>
<members>ABC</members>
<members>ABC</members>
<name>ABC</name>
</type>
<type>
<members>system</members>
<name>ABC</name>
</type>
<version>XYZ</version>
</Package>


<?xml version="1.0" encoding="ABCCD">
<type>
<members>ABC</members>
<members>ABC</members>
<name>ABC</name>
</type>
<type>


if the output is OK. use -i option in sed to do inline edit.






share|improve this answer




















  • 1





    yes working.Thanks

    – user343859
    yesterday











  • Now the output come like this as below.I don't want the 2 lines between </type><type> ...... <?xml version="1.0" encoding="ABCCD"> <type> <members>ABC</members> <members>ABC</members> <name>ABC</name> </type> <type> <members>system</members> <name>ABC</name> </type> <version>XYZ</version> </Package>

    – user343859
    yesterday












  • @user343859 try my update

    – msp9011
    yesterday











  • can u update the same in question?

    – msp9011
    yesterday











  • Thanks.....sed 's/<type>/n<type>n/g' is working .Spacing is not an issue now

    – user343859
    yesterday

















1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














Try this,



 sed 's/><type>/>n<type>/g;s/<type></<type>n</g' file.xml


will search for the pattern ><type> then add a new line before the <type> and search for the pattern <type>< then add a new line after of <type>.



<?xml version="1.0" encoding="ABCCD">
<type>
<members>ABC</members>
<members>ABC</members>
<name>ABC</name>
</type>
<type>
<members>system</members>
<name>ABC</name>
</type>
<version>XYZ</version>
</Package>


<?xml version="1.0" encoding="ABCCD">
<type>
<members>ABC</members>
<members>ABC</members>
<name>ABC</name>
</type>
<type>


if the output is OK. use -i option in sed to do inline edit.






share|improve this answer




















  • 1





    yes working.Thanks

    – user343859
    yesterday











  • Now the output come like this as below.I don't want the 2 lines between </type><type> ...... <?xml version="1.0" encoding="ABCCD"> <type> <members>ABC</members> <members>ABC</members> <name>ABC</name> </type> <type> <members>system</members> <name>ABC</name> </type> <version>XYZ</version> </Package>

    – user343859
    yesterday












  • @user343859 try my update

    – msp9011
    yesterday











  • can u update the same in question?

    – msp9011
    yesterday











  • Thanks.....sed 's/<type>/n<type>n/g' is working .Spacing is not an issue now

    – user343859
    yesterday















0














Try this,



 sed 's/><type>/>n<type>/g;s/<type></<type>n</g' file.xml


will search for the pattern ><type> then add a new line before the <type> and search for the pattern <type>< then add a new line after of <type>.



<?xml version="1.0" encoding="ABCCD">
<type>
<members>ABC</members>
<members>ABC</members>
<name>ABC</name>
</type>
<type>
<members>system</members>
<name>ABC</name>
</type>
<version>XYZ</version>
</Package>


<?xml version="1.0" encoding="ABCCD">
<type>
<members>ABC</members>
<members>ABC</members>
<name>ABC</name>
</type>
<type>


if the output is OK. use -i option in sed to do inline edit.






share|improve this answer




















  • 1





    yes working.Thanks

    – user343859
    yesterday











  • Now the output come like this as below.I don't want the 2 lines between </type><type> ...... <?xml version="1.0" encoding="ABCCD"> <type> <members>ABC</members> <members>ABC</members> <name>ABC</name> </type> <type> <members>system</members> <name>ABC</name> </type> <version>XYZ</version> </Package>

    – user343859
    yesterday












  • @user343859 try my update

    – msp9011
    yesterday











  • can u update the same in question?

    – msp9011
    yesterday











  • Thanks.....sed 's/<type>/n<type>n/g' is working .Spacing is not an issue now

    – user343859
    yesterday













0












0








0







Try this,



 sed 's/><type>/>n<type>/g;s/<type></<type>n</g' file.xml


will search for the pattern ><type> then add a new line before the <type> and search for the pattern <type>< then add a new line after of <type>.



<?xml version="1.0" encoding="ABCCD">
<type>
<members>ABC</members>
<members>ABC</members>
<name>ABC</name>
</type>
<type>
<members>system</members>
<name>ABC</name>
</type>
<version>XYZ</version>
</Package>


<?xml version="1.0" encoding="ABCCD">
<type>
<members>ABC</members>
<members>ABC</members>
<name>ABC</name>
</type>
<type>


if the output is OK. use -i option in sed to do inline edit.






share|improve this answer















Try this,



 sed 's/><type>/>n<type>/g;s/<type></<type>n</g' file.xml


will search for the pattern ><type> then add a new line before the <type> and search for the pattern <type>< then add a new line after of <type>.



<?xml version="1.0" encoding="ABCCD">
<type>
<members>ABC</members>
<members>ABC</members>
<name>ABC</name>
</type>
<type>
<members>system</members>
<name>ABC</name>
</type>
<version>XYZ</version>
</Package>


<?xml version="1.0" encoding="ABCCD">
<type>
<members>ABC</members>
<members>ABC</members>
<name>ABC</name>
</type>
<type>


if the output is OK. use -i option in sed to do inline edit.







share|improve this answer














share|improve this answer



share|improve this answer








edited yesterday

























answered yesterday









msp9011msp9011

4,54244167




4,54244167







  • 1





    yes working.Thanks

    – user343859
    yesterday











  • Now the output come like this as below.I don't want the 2 lines between </type><type> ...... <?xml version="1.0" encoding="ABCCD"> <type> <members>ABC</members> <members>ABC</members> <name>ABC</name> </type> <type> <members>system</members> <name>ABC</name> </type> <version>XYZ</version> </Package>

    – user343859
    yesterday












  • @user343859 try my update

    – msp9011
    yesterday











  • can u update the same in question?

    – msp9011
    yesterday











  • Thanks.....sed 's/<type>/n<type>n/g' is working .Spacing is not an issue now

    – user343859
    yesterday












  • 1





    yes working.Thanks

    – user343859
    yesterday











  • Now the output come like this as below.I don't want the 2 lines between </type><type> ...... <?xml version="1.0" encoding="ABCCD"> <type> <members>ABC</members> <members>ABC</members> <name>ABC</name> </type> <type> <members>system</members> <name>ABC</name> </type> <version>XYZ</version> </Package>

    – user343859
    yesterday












  • @user343859 try my update

    – msp9011
    yesterday











  • can u update the same in question?

    – msp9011
    yesterday











  • Thanks.....sed 's/<type>/n<type>n/g' is working .Spacing is not an issue now

    – user343859
    yesterday







1




1





yes working.Thanks

– user343859
yesterday





yes working.Thanks

– user343859
yesterday













Now the output come like this as below.I don't want the 2 lines between </type><type> ...... <?xml version="1.0" encoding="ABCCD"> <type> <members>ABC</members> <members>ABC</members> <name>ABC</name> </type> <type> <members>system</members> <name>ABC</name> </type> <version>XYZ</version> </Package>

– user343859
yesterday






Now the output come like this as below.I don't want the 2 lines between </type><type> ...... <?xml version="1.0" encoding="ABCCD"> <type> <members>ABC</members> <members>ABC</members> <name>ABC</name> </type> <type> <members>system</members> <name>ABC</name> </type> <version>XYZ</version> </Package>

– user343859
yesterday














@user343859 try my update

– msp9011
yesterday





@user343859 try my update

– msp9011
yesterday













can u update the same in question?

– msp9011
yesterday





can u update the same in question?

– msp9011
yesterday













Thanks.....sed 's/<type>/n<type>n/g' is working .Spacing is not an issue now

– user343859
yesterday





Thanks.....sed 's/<type>/n<type>n/g' is working .Spacing is not an issue now

– user343859
yesterday



Popular posts from this blog

getting Checkpoint VPN SSL Network Extender working in the command lineHow to connect to CheckPoint VPN on Ubuntu 18.04LTS?Will the Linux ( red-hat ) Open VPNC Client connect to checkpoint or nortel VPN gateways?VPN client for linux machine + support checkpoint gatewayVPN SSL Network Extender in FirefoxLinux Checkpoint SNX tool configuration issuesCheck Point - Connect under Linux - snx + OTPSNX VPN Ububuntu 18.XXUsing Checkpoint VPN SSL Network Extender CLI with certificateVPN with network manager (nm-applet) is not workingWill the Linux ( red-hat ) Open VPNC Client connect to checkpoint or nortel VPN gateways?VPN client for linux machine + support checkpoint gatewayImport VPN config files to NetworkManager from command lineTrouble connecting to VPN using network-manager, while command line worksStart a VPN connection with PPTP protocol on command linestarting a docker service daemon breaks the vpn networkCan't connect to vpn with Network-managerVPN SSL Network Extender in FirefoxUsing Checkpoint VPN SSL Network Extender CLI with certificate

Cannot Extend partition with GParted The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) 2019 Community Moderator Election ResultsCan't increase partition size with GParted?GParted doesn't recognize the unallocated space after my current partitionWhat is the best way to add unallocated space located before to Ubuntu 12.04 partition with GParted live?I can't figure out how to extend my Arch home partition into free spaceGparted Linux Mint 18.1 issueTrying to extend but swap partition is showing as Unknown in Gparted, shows proper from fdiskRearrange partitions in gparted to extend a partitionUnable to extend partition even though unallocated space is next to it using GPartedAllocate free space to root partitiongparted: how to merge unallocated space with a partition

Marilyn Monroe Ny fiainany manokana | Jereo koa | Meny fitetezanafanitarana azy.