command to compare lines in a file?
i want to go through a file, line by line to see if any lines are the same. what command does this?
i'm reading through diff and compare but they seem to be for comparing 2 different files. thanks! |
Hi.
Look at man uniq ... cheers, makyo |
You could use sort/uniq/diff to find those lines. There are probably simpler solutions :)
Code:
sort textfile.txt > sorted.txt |
read the man file on uniq, the -d option only prints duplicate lines.
sort textfile.txt|uniq -d should get you what you want and it's a little more elegant. Quote:
|
thanks all!
i hadnt heard of uniq before and didnt find it with apropos. |
All times are GMT -5. The time now is 09:34 PM. |