What am I doing wrong, sort and remove dups

None-yet

Member
Credits
701
Someone , anyone, help! lol

I have a file to sort and remove dups. I am using cat sort -u unsorted.txt and I think that is correct but as per below I must be doing something wrong. I know I am a bit rusty but what am I doing wrong?
[email protected]:~/Desktop# cat sort -u unsorted.txt
cat: sort: No such file or directory
cat: unsorted.txt: No such file or directory
[email protected]:~/Desktop#


Thanks
 


f33dm3bits

Gold Member
Gold Supporter
Credits
6,156
Someone , anyone, help! lol

I have a file to sort and remove dups. I am using cat sort -u unsorted.txt and I think that is correct but as per below I must be doing something wrong. I know I am a bit rusty but what am I doing wrong?
[email protected]:~/Desktop# cat sort -u unsorted.txt
cat: sort: No such file or directory
cat: unsorted.txt: No such file or directory
[email protected]:~/Desktop#


Thanks
You don't need to cat the file in order to sort it, you can just use sort alone on the file your want to sort. The file unsorted.txt isn't located in the Desktop directory, you probably saved the file to a different directory. Try to find it like this:
Code:
find /home/username -name unsorted.txt
Replacing username with your user, which you used to log into the system.
 
Last edited:

f33dm3bits

Gold Member
Gold Supporter
Credits
6,156
Yeah, the file is on the desktop. That's part of what I didn't understand. I tried with and without cat and neither worked.

Lost my other computer in a tornado earlier this year here in Chattanooga. Did a "Don't remember my password" but got no return on the email. Thought I may have used a long lost email.
Right now cat thinks sort(which doesn't exist) is a file. Seems unsorted.txt isn't seen as well, that is strange.
 
Last edited:

f33dm3bits

Gold Member
Gold Supporter
Credits
6,156
Can you show an ls -l of your Desktop directory.
 

None-yet

Member
Credits
701
[email protected]:~/Desktop# cat sort -u unsorted.txt
cat: sort: No such file or directory
cat: unsorted.txt: No such file or directory
[email protected]:~/Desktop# ls -i
11541716 prerelease 11541713 unsoted.txt
[email protected]:~/Desktop#

That makes me so mad. As soon as I saw it come up I saw I had misspelled it. Stop laughing. Dad-gum that burns me. Like I said I am rusty.

One last thing. Before I mess up again, what would be the correct syntax to sort > remove dups > output to another file?
 

f33dm3bits

Gold Member
Gold Supporter
Credits
6,156
Everybody makes mistakes, mistakes are learning opportunities;) I'm not sure what you mean by "remove dups"
 

f33dm3bits

Gold Member
Gold Supporter
Credits
6,156
Everybody makes mistakes, mistakes are learning opportunities;) I'm not sure what you mean by "remove dups"
Oh, do you mean remove duplicates?
Code:
sort -u unsorted.txt > output.txt
Als I meant ls -l(as L in Linda but lowercase). Try man ls.
 

f33dm3bits

Gold Member
Gold Supporter
Credits
6,156
Yessir, my shorthand. OK, great, Thanks. I need a break. I am still burning but sure many will see this and enjoy. Thanks again for the rescue!
No problem! And welcome to linux.org! Be sure to drop by and introduce yourself in the Introduction Section so you can meet the other members! :)
 


Members online


Top