Sara has asked for the wisdom of the Perl Monks concerning the following question:

Hello , I am using cleardiff to compare the changes in a file , I am really concern about the lines that were changed , so when I run cleardiff , I get the following :
$ cleardiff v5/srcc/smestrans.cpp/6 v5/srcc/smestrans.cpp/7 ******************************** <<< file 1: v5/srcc/smestrans.cpp/6 >>> file 2: v5/srcc/smestrans.cpp/7 ******************************** ------[after 42]-----------|------[inserted 43]------------- -| #include "lyr1.h" // Laye+ |- ----[changed 519]----------|-----[changed to 520-522]----- if ( _instd->phy_comm_chan+|//if ( _instd->phy_comm_ch+ -| |if ( _instd->phy_comm_chan+ |- -----[changed 531]---------|-----[changed to 534-535]------ if ( _instd->phy_comm_chan+|if ( (Layer1Entity::FindV5+ -| == V52StackPtr->Ge+ |-
so what I care about , is getting the numbers on the right side which are 43 520-522 534-535 and send them to an output file which will look like this
43 520-522 543-535
thanks for hints guys

Replies are listed 'Best First'.
Re: parsing cleardiff output :(
by DamnDirtyApe (Curate) on Jul 17, 2002 at 15:58 UTC

    This seems to do the job:

    while ( <> ) { s{ -\|-.*? # After the -|- thingy ( \d+(?:-\d+)? # A number, maybe two ) } { print $1 . "\n" }egx ; }

    _______________
    D a m n D i r t y A p e
    Home Node | Email
      THANKS!!!!!!!!!!
Re: parsing cleardiff output :(
by RMGir (Prior) on Jul 17, 2002 at 15:51 UTC
    Hmmm, ClearCase. Loved that system...
    while(<>) { next unless /^-+\[[^\]]+\]-*\|-*\[[^0-9]+([^\]]+)\]/; print "$1\n"; }
    Wow, that looks like line noise :)
    --
    Mike