Here is a Ruby to do that:
ruby -lne 'BEGIN{cnt=Hash.new {|h,k| h[k] = 0} }
cnt[$_]+=1
END{puts cnt.select{|k,v| v==1}.keys.join("\n") }
' file
Prints:
4
3
Or, in one read of the file:
ruby -e 'puts $<.read.split(/\R+/).
group_by{|x| x}.select{|k,v| v.length==1}.keys.join("\n")
' file
# same output
Unlike awk, Ruby associative arrays maintain insertion order.
If you want a one pass awk you could do:
awk 'BEGIN{OFS="\t"}
{ if (seen[$0]++) delete order[$0]; else order[$0]=FNR }
END { for ( e in order ) print order[e], e } ' file | sort -nk 1,1 | cut -f2-
# same output
(Thanks Ed Morton for a better awk!)
Get-Content .\data.txt | Group-Object | Where-Object { $_.Count -le 1 } | Select -ExpandProperty Name