in reply to multi-line match

hi, i have recieved a new file which contains no new lines between entries eg
*header asdasdddas asdsadds *header sdsdasd asdsdds
I have tried modding the suggestions above but they all come back with garbage, and i have super searched as well to no avail. sorry to ask for help gain so soon, but time is pressing! Thanks in advance PC

Replies are listed 'Best First'.
Re: Re: multi-line match
by BrowserUk (Patriarch) on Aug 07, 2003 at 11:23 UTC

    The easiest way would be to use two passes. The first adds a blank line before each header:

    perl -ple"$_ = qq[\n] . $_ if /^*header/" infile >modified

    NB! Different quotes on *nix!

    The second pass is just which ever of the earlier answers you like best.


    Examine what is said, not who speaks.
    "Efficiency is intelligent laziness." -David Dunham
    "When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller
    If I understand your problem, I can solve it! Of course, the same can be said for you.

      Thanks very much BrowserUk and all monks, i'm still sorting out different multiline queries but i am determined to get there! thanks again!