Remove double lines in a file (grep, sed ...)

Using the grep command, how can I do to suppress the double lines in a input file.
Thanks for your answers.
kindelbergerAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
gcauthonConnect With a Mentor Commented:
use the nl command too like so:

cat testfile |nl |sort +1 |uniq -s 6 |sort +0n |sed 's/^[    0-9]*//'

by the way, the pattern for sed contains a space and a tab to remove the number introduced by nl.  The line numbers basically keep the original ordering so that the lines can be sorted and uniq'd and then rearranged back the way they were.
0
 
ahoffmannCommented:
uniq inputfile
# or if it the double lines are not following each other
sort inputfile|uniq
0
 
kindelbergerAuthor Commented:
Thanks for your help, but the lines are not following each other and I can not use the sort command because I need to keep the existing order of the lines.
Is there another solution for my  problem ?
Thanks.
0
All Courses

From novice to tech pro — start learning today.