#!/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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |