I know my title is not much self-explanatory but let me try to explain it here.
I have a file name test.txt which has some duplicate lines. Now, what I want
test.txt
You can use vim for editing file in-place:
$ ex -s +'%!sort' -cxa test.txt
Multiple files:
$ ex -s +'bufdo!%!sort' -cxa *.*