Languages and Scripting
cancel
Showing results for 
Search instead for 
Did you mean: 

Remove consecutive duplicated lines from a file

 
SOLVED
Go to solution
Highlighted
gaudiobe
Advisor

Remove consecutive duplicated lines from a file

Hello,

I need an help in order to remove some duplicated lines from a text file.

######### INPUT FILE ###########

ABC

CDE

FGH

FGH

ABC

ABC

ABC

FGH

CDE

CDE

#####################################

 

DESIRED OUTPUT

######### OUTPUT FILE ###########

ABC

CDE

FGH

ABC

FGH

CDE

#####################################

I do not need to order the file. buto only to remove duplicated lines if they are consecutive.

Thanks in advance for your help.

 

Regards,

Bernardo

1 REPLY 1
Highlighted
Solution

Re: Remove consecutive duplicated lines from a file

not really a HP-UX sepcific question - there are lots of ways to do this and some simple google-fu would have found some...

This selection of answers was near the top of my search response:

https://stackoverflow.com/questions/1444406/how-to-delete-duplicate-lines-in-a-file-without-sorting-it-in-unix

 


I am an HPE Employee
Accept or Kudo