удалить дубликаты ссылок из файла - PullRequest

Ответы [ 2 ]

0 голосов
/ 12 октября 2018

Я надеюсь, что это удалит все дубликаты ссылок из вашего файла, но должны быть точно такие же значения.

sort -u your-link-file.txt

И если вы хотите сохранить его в другом файле, используйте это

cat your-link-file.txt | sort -u > result.txt
0 голосов
/ 12 октября 2018

Не могли бы вы попробовать следующее.

awk -F'[#?]' '!a[$1]++'  Input_file

Объяснение вышеуказанного кода:

awk -F'[#?]' '    ##Starting awk script from here and making field separator as #(hash) and ?(literal character) as per OP sample Input_file provided.
!a[$1]++          ##Creating an array whose index is $1(first field of current line). Checking condition if $1 is NOT present in a then increase its value with 1.
                  ##And ! condition will make sure each lines $1 should come only 1 time in array a so by doing this all duplicates will NOT be printed.
' Input_file      ##Mentioning Input_file name here.
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...