Я объединил два файла в один и пытаюсь отсортировать объединенный файл, но похоже, что мне чего-то не хватает, потому что один из файлов, которые я объединил, пуст. Ниже я показываю описание сделанного мной ввода и вывода:
File1 has this data:
John#Smith#3400#2000.00
Blue#Light##2300#9000.00
John#Smith#3400#2000.00
Hidey#George#1000#2000.00
Blue#Light##2300#9000.00
Trasy#Brown#2000#4000.00
Hidey#George#1000#2000.00
1_ I looked for unique values by using this command and stored the output in a new file:
$ uniq -u File1 > File2
and the output of File2 is empty because there were not unique values in File1
2_ I looked for duplicate values by using this command and stored the output in a new file:
$ uniq -d File1 > File3
Here I got the unique values and I stored them in File3
3_ I combined the two files (File2 and File3)
Here I got the unique values and I stored them in File3
4_ When I came to merge File2 with File3
I used this command: cat File2 File3 > File4
I got a result as showing below:
-----------------------------------
|$ John#Smith#3400#2000.00 |
|$ Hidey#George#1000#2000.00 |
|$ Blue#Light##2300#9000.00 |
|$ Trasy#Brown#2000#4000.00 |
|$ Hidey#George#1000#2000.00 |
-----------------------------------
Это означает, что два файла были объединены, а пространство слева образовалось из-за пустого файла.
Мне нужна помощь в сортировке File4 по второму полю и в обратном порядке. Я пробовал эту команду: $ sort -k2,2 -r File4 Я не видел другого отображения порядка данных, и он просто изменил его. Как отсортировать два объединенных файла относительно того, что один из них пуст и вызвал пробел в новом файле.