in reply to delete lines

$ perl -ne "print unless /^<\?xml version/ .. /^<\/Info>/" input.xml > +output.pseudoxml

(assuming the </PackageInfo> in your description refers to the </Info> in the data)

See the flip-flop operator.

Replies are listed 'Best First'.
Re^2: delete lines
by Anonymous Monk on Oct 29, 2009 at 09:18 UTC
    Please tell me how can I add this in a script

      What script? almut gave you a complete script to perform the task you asked for. If you want to do something else, have further requirements, or you have existing code you want to add this facility to you have to give us more information. We can invent all sorts of things you might be trying to achieve, but that is a waste of our time and a waste of your time. Save some time all round by posting a cogent question with sufficient context that we can give you useful answers.


      True laziness is hard work

      It somewhat depends on the context of what you want to do...  but this might be a starting point:

      #!/usr/bin/perl while (<>) { # skip initial unwanted lines next if /^<\?xml version/ .. /^<\/Info>/; # process the lines you want... print; }

      You can of course also explicitly open the file instead of using the magic <>.