Supposing I have a file named sample.txt which contains data in the following format:
1 John 2 Crema 3 Abraham 1 John
I can read the file line by line using the following way:
while read p do echo $p done <sample.txt
Is there any way that I can compare a particular line with its following lines so that I can perform multiple task such as duplicate elimination or pattern matching, etc? What additional things will I have to add to accomplish the comparison task?