#!/bin/perl $FILEIN = shift (); $FILEOUT = shift (); open(FILE, "<$FILEIN"); open(SAIDA, ">$FILEOUT"); @arquivo = <FILE>; # VETOR #@arquivo = sort(@arquivo); foreach $linha (@arquivo) { if($linha=~/(^.+<HR>Campo_Identificacao\()[^0-9]*<b>([0-9]{5,7}\-[ +^\,]*)</b>(\,.+)/) { <b>$NumProc = $2;</b> #$linhaTemp = $1."\#\$".$3; } #push @novo_array, <b>$NumProc</b> if not <b>$NumProc_anterior{ +$linha}++;</b> } print SAIDA @novo_array; close (SAIDA); close (FILE);

Hi, i would like to know how i verify multiple lines, and if the code finds that $NumProc String exists at the exact same position in the next line it would wipe out the next line, keeping only the first line found. The commented #push @novo_array line verified if the lines were exactly the same, but i want to go further and verify only if the line has the same number at the same position, hence repeated useless information.<\p>

<DI:"def.def"><RD:Item><PS:Item>Campo_Ementa ###HERE GOES THE TEXT THA +T I DONT WANT TO VERIFY[a-zA-Zetcetc]*### <HR>Campo_Identificacao(Rec +urso Inominado nº <b>0702995-42.2017.8.01.0002</b>, 1ª Turma Recursal + dos Juizados Especiais/AC, Rel. Maria Rosinete dos Reis Silva. j. 11 +.07.2018 , Publ. 20.07.<FD:AnoJulg>2018</FD:AnoJulg>).<HR><PS:Identif +icacao>

---->0702995-42.2017.8.01.0002 being the number i want to use to batch clean the document, keeping only the first time it found, completely wiping out the rest. It will be mounted into a .NFO afterwards, so i would need to keep the line intact.


In reply to Array Exact Position Filter by Perolizador

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.