I have two XML file first one ~/tmp/test.xml
second one /data/myuser/.mycontent/mytest.xml
I want to add all of the content on the first XML file to line 35 in the second one. I tried the following but with no luck
sed -n '35,~/tmp/test.xml`' /data/myuser/.mycontent/mytest.xml (cat /data/myuser/.mycontent/mytest.xml; echo) | sed '35r ~/tmp/test.xml' ed -s ~/tmp/test.xml <<< $'35r /data/myuser/.mycontent/mytest.xml\nw'
Line 33 from second XML file line 34 is empty
#the following tags contain employee location
XML tag in the first XML file
<Location "/mylocation"> first Address second Address Mylocation "XX/XX/XX/XX" Myphone "XXXXXXX" </Location>
What did I do wrong, please advise .
Edit 1
first XML ~/tmp/test.xml
file contain only
<Location "/mylocation"> first Address second Address Mylocation "XX/XX/XX/XX" Myphone "XXXXXXX" </Location>
second XML /data/myuser/.mycontent/mytest.xml
contain:
NameVirtualHost *:XXXX <VirtualHost *:XXXX> ServerName AAAAAAAA # Manager comment 1 # Manager comment 2 # Manager comment 3 # DocumentRoot "/data/myuser/.mycontent/" # support email [email protected] # started at 2010 <employee /*> AllowOverride None </employee> <Location "/"> mylocation Deny from all </Location> <Location "/icons/"> # employee info my employee info Allow from all </Location> DavLockDB /tmp/${APACHE_HOSTNAME}.DavLock DAVMinTimeout 5000 LimitXMLRequestBody 0 # This should be changed to whatever you set DocumentRoot to. ## I need to add new tags here ## <Location "/employee1"> first Address second Address Mylocation "XX/XX/XX/XX" Myphone "XXXXXXX" </Location> <Location "/employee2"> first Address second Address Mylocation "XX/XX/XX/XX" Myphone "XXXXXXX" </Location> ## more tags same as above ## then manager comment
Edit 2 second file /data/myuser/.mycontent/mytest.xml
should be like:
NameVirtualHost *:XXXX <VirtualHost *:XXXX> ServerName AAAAAAAA # Manager comment 1 # Manager comment 2 # Manager comment 3 # DocumentRoot "/data/myuser/.mycontent/" # support email [email protected] # started at 2010 <employee /*> AllowOverride None </employee> <Location "/"> mylocation Deny from all </Location> <Location "/icons/"> # employee info my employee info Allow from all </Location> DavLockDB /tmp/${APACHE_HOSTNAME}.DavLock DAVMinTimeout 5000 LimitXMLRequestBody 0 # This should be changed to whatever you set DocumentRoot to. ## I need to add new tags here ## ## this tag from first file <Location "/mylocation"> first Address second Address Mylocation "XX/XX/XX/XX" Myphone "XXXXXXX" </Location> ## edit end <Location "/employee1"> first Address second Address Mylocation "XX/XX/XX/XX" Myphone "XXXXXXX" </Location> <Location "/employee2"> first Address second Address Mylocation "XX/XX/XX/XX" Myphone "XXXXXXX" </Location> ## more tags same as above ## then manager comment
Note: ## this tag from first file
and ## edit end
to specify merge location location