File1:
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16
17 18 19 20
File2:
9 10 11 12
21 22 23 24
1 2 3 4
17 18 19 20
I’m new to unix and I’m trying to obtain the unique rows from each file and output them into a new file, not printing the duplicates, files are Unsorted.
You want
sort -nanduniq -u:Edit:
Here
uis the name of an associative array, you could name it anything (I choose u short for unique). The keys (k) in the array are the lines in the files so every time a duplicate line is seen the count is increased. After the array is built we loop through the array and only print the key if it was only seen once, this code should help clear it up: