Deleting rows from a csv file with bat or shell

0

I have a file with 150k lines, in these lines I contain information that goes to a label printer. But at the time of printing, the program checks the 150k lines to see if there is any duplicity, it greatly disrupts the printing process.

How can I create a .bat to delete most of these lines, decreasing the crawl time? I tried using power shell, but I could only delete and .txt files, .csv I can not.

$Arquivo="C:\Users\Cis da Amazonia\Desktop\LR21DataCombine.txt"


$Conteudo = Get-Content -path $Arquivo

#Retira as linhas por quatidade
$tmp = $Conteudo[2..($Conteudo.Length-1)]

#Grava Modificações
$tmp > $Arquivo
    
asked by anonymous 07.04.2017 / 23:03

1 answer

0

Here it worked normally just by pointing to the CSV file instead of the txt, what is wrong with you?

I did the Test as well

$Arquivo="C:\Users\Cis da Amazonia\Desktop\LR21DataCombine.csv"

$Conteudo = Get-Content -path $Arquivo

#Retira as linhas por quatidade
$tmp = $Conteudo[2..($Conteudo.Length-10000)]

#Grava Modificações
$tmp > $Arquivo
    
10.04.2017 / 14:43