-1

I have query if I can remove few lines from a file in between string. I have an example below:

Eg: XML file. < String > Data1 Data2 Data2 < / String >

I have a huge XML file in which I want to search a string & delete the data in between the string. Along with the string.

how is it possible using a shell script?

  • 2
    XML is a standard, there are many ways to manipulate it, but you need to be more clear, give an example of the XML file and the desired result, XML is refereed to in nodes, paths, attributes elements etc. not strings and the bit between the strings! – Sum1sAdmin Dec 20 '17 at 12:20

1 Answers1

0
$ cat t.test | sed 's#< String >.\+< / String >#< String >< / String >#'


< String >< / String >

You should probably use a proper XML parser though... Python would make short work of the task.

Daniel Widrick
  • 3,488
  • 2
  • 13
  • 27