in reply to Doubts group data

$ perl -an '-F/\|\|\|/' -e 'm/\d/ or do{print qq<$k|||$v|||\n> ;$k= +$v="";next};$k=$F[0];$v.=$F[1].qq|;|' data2.txt 21997|||70049,,20170428154818,20170527235959;70070,,20170428154739,201 +70527235959;||| 21998|||70049,,20170428154818,20170527235959;70070,,20170428154739,201 +70527235959;70071,,20170428154739,20170527235959;|||

        ...Disinformation is not as good as datinformation.               Don't document the program; program the document.

Replies are listed 'Best First'.
Re^2: Doubts group data
by Anonymous Monk on May 04, 2017 at 13:30 UTC
    Dear, I ran a test with this command line and it did not work. See below:

    cat teste.txt

    21997|||70049,,20170428154818,20170527235959||| 21997|||70070,,20170428154739,20170527235959||| 21998|||70049,,20170428154818,20170527235959||| 21998|||70070,,20170428154739,20170527235959||| 21998|||70071,,20170428154739,20170527235959||| perl -an '-F/\|\|\|/' -e 'm/\d/ or do{print qq<$k|||$v|||\n> ;$k=$v="" +;next};$k=$F[0];$v.=$F[1].qq|;|' teste.txt </p> Not Result for this command. My perl version is: perl -v This is perl, v5.10.1 (*) built for x86_64-linux-thread-multi
      Your data does not have the blank line separating entries with the same ID.

      My code also requires a trailing line separator.

              ...Disinformation is not as good as datinformation.               Don't document the program; program the document.

      His code depends on having a blank line between the 21997s and 21998s (as you show in your original post), and one at the end of the file. This limitation is easily fixable.
        Can you help me fix it?