Hi

I need a perl reg-expression which extracts the pattern as below.

Basically we want to parse and extract the rpms from the packages.xml inside RHEL cd hence looking for a pattern which extracts the contents between >xyz</rpm>.

Note there might be any set of character/white space before > symbol but all the lines ends with </rpm> pattern.

Any help with regard to this is of great help.

Eg:
<rpm>acl-2.2.39-3.el5.x86_64.rpm</rpm> <rpm>acpid-1.0.4-9.el5_4.2.x86_64.rpm</rpm> <rpm>attr-2.4.32-1.1.x86_64.rpm</rpm> <rpm>audispd-plugins-1.7.13-2.el5.x86_64.rpm</rpm> <rpm>audit-1.7.13-2.el5.x86_64.rpm</rpm> <rpm>audit-libs-python-1.7.13-2.el5.x86_64.rpm</rpm> <rpm>basesystem-8.0-5.1.1.noarch.rpm</rpm> <rpm>libtermcap-2.0.8-46.1.x86_64.rpm</rpm> <rpm>bash-3.2-21.el5.x86_64.rpm</rpm> <rpm component="pamperuser04_rhel52_32" package="pam-per-user- +0.4">pam_per_user-0.4-2053.vmw.i686.rpm</rpm> <rpm component="libusb0112_rhel52_32" package="libusb-0.1.12"> +libusb-0.1.12-5.1.2053.vmw.i686.rpm</rpm> <rpm component="usbutils071_rhel52_32" package="usbutils-0.71" +>usbutils-0.71-2.1.2073.vmw.i686.rpm</rpm> <rpm component="libidn065_rhel52_32" package="libidn-0.6.5">li +bidn-0.6.5-1.1.2053.vmw.i686.rpm</rpm>

Thanks in advance

asab

In reply to Search pattern from end of line by asab

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.