I want to compare and substitute strings present in different lines in unix
For example I have a file with two words in each line
<a> <b>
<d> <e>
<b> <c>
<c> <e>
If second word of any line matched with first word of any other line then second word of this line should be replaced with second word of matched line and it should iterate until there is no match between second word of the line with first word of another line
I need result like
<a> <e>
<b> <e>
<c> <e>
<d> <e>
I am new to unix and not getting any idea how to implement this. Can any one give suggestions or explain how we can do this
See Question&Answers more detail:os