Linux Tux logo

Для удаления дубликатов строк из файла можно воспользоваться конструкцией вида:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
sort -u old_file > new_file
sort -u old_file > new_file
sort -u old_file > new_file

Но если нужно удалить дубликаты без сортировки файла, то можно сделать так:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
awk '!x[$0]++' old_file > new_file
awk '!x[$0]++' old_file > new_file
awk '!x[$0]++' old_file > new_file