awk - Adding new lines in XML file -


i have bunch of xml-files start xml-declaration

<?xml version="1.0" encoding="utf-8"?> 

after final ">" goes on directly start of following tag - this: <?xml version="1.0" encoding="utf-8"?><tag>

i split there make new line followed new line. this:

<?xml version="1.0" encoding="utf-8"?> new line new line <tag> 

how done?

many in advance:-)

/paul

with sed:

amd$ sed 's/<?xml version="1.0" encoding="utf-8"?>/&\n\n\n/' file <?xml version="1.0" encoding="utf-8"?>   <tag> 

just replace pattern <?xml version="1.0" encoding="utf-8"?> same pattern followed 3 newlines (this create 2 newlines before <tag>.

use sed -i.bak 's/<?xml version="1.0" encoding="utf-8"?>/&\n\n\n/' file inplace substitution.


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -