Unexpected exit

3

I'm running this command to remove repeated lines from a file:

cat arquivo.csv | (read;echo "$REPLY"; sort) | uniq > arquivo.csv

But when I look at the file, it is blank rather than just the lines that do not repeat themselves. What am I doing wrong?

    
asked by anonymous 18.05.2018 / 18:41

2 answers

1

You can do this by using the sort.

sort -u arquivo.csv -o arquivo.csv
  • -u will remove duplicate lines
  • -o will send the output to the .csv file
18.05.2018 / 21:11
2

You can use the command:

cat arquivo.csv | sort | uniq > novoArquivo.csv
    
18.05.2018 / 20:37