Hi all, i have a question to ask..i want to read an input file and write it to a new output file,
the content of my input file as follows (not limited to these item only, can have up to hundreds items):
Device <blank space> Type <blank space> Year <blank space> Status <blank space> Company
electronic/trend/latest/mp3 <blank space> ipod <blank space> 2012 <blank space> secondhand <blank space> apple
electronic/trend/latest/phone <blank space> Samsungs5<blank space> 2014 <blank space> secondhand <blank space> samsung
electronic/trend/latest/laptop <blank space> EliteBook<blank space> 2011 <blank space> secondhand <blank space> hp
electronic/trend/latest/iphone <blank space> iphone6 <blank space> 2014 <blank space> new <blank space> apple
electronic/trend/latest/phone <blank space> Samsungs5<blank space> 2014 <blank space> new <blank space> samsung
electronic/trend/latest/monitor <blank space> xpro <blank space> 2012 <blank space> secondhand <blank space> dell
First i need to remove the duplicate path + device and take the last occurence (in this example Samsungs5 has duplicate path and device, only take last occurence)
Second is need to display in the following format:
Path <blank space> Device <blank space> Type <blank space> Status
electronic/trend/latest <blank space> mp3 <blank space> ipod <blank space> secondhand
electronic/trend/latest <blank space> laptop <blank space> EliteBook<blank space> secondhand
electronic/trend/latest <blank space> iphone <blank space> iphone6 <blank space> new
electronic/trend/latest <blank space> phone <blank space> Samsungs5<blank space> new
electronic/trend/latest <blank space> monitor <blank space> xpro <blank space> secondhand
the Year, Company and the duplicate item is remove and only display last occurence of Samsungs5.
thanks in advance
the content of my input file as follows (not limited to these item only, can have up to hundreds items):
Device <blank space> Type <blank space> Year <blank space> Status <blank space> Company
electronic/trend/latest/mp3 <blank space> ipod <blank space> 2012 <blank space> secondhand <blank space> apple
electronic/trend/latest/phone <blank space> Samsungs5<blank space> 2014 <blank space> secondhand <blank space> samsung
electronic/trend/latest/laptop <blank space> EliteBook<blank space> 2011 <blank space> secondhand <blank space> hp
electronic/trend/latest/iphone <blank space> iphone6 <blank space> 2014 <blank space> new <blank space> apple
electronic/trend/latest/phone <blank space> Samsungs5<blank space> 2014 <blank space> new <blank space> samsung
electronic/trend/latest/monitor <blank space> xpro <blank space> 2012 <blank space> secondhand <blank space> dell
First i need to remove the duplicate path + device and take the last occurence (in this example Samsungs5 has duplicate path and device, only take last occurence)
Second is need to display in the following format:
Path <blank space> Device <blank space> Type <blank space> Status
electronic/trend/latest <blank space> mp3 <blank space> ipod <blank space> secondhand
electronic/trend/latest <blank space> laptop <blank space> EliteBook<blank space> secondhand
electronic/trend/latest <blank space> iphone <blank space> iphone6 <blank space> new
electronic/trend/latest <blank space> phone <blank space> Samsungs5<blank space> new
electronic/trend/latest <blank space> monitor <blank space> xpro <blank space> secondhand
the Year, Company and the duplicate item is remove and only display last occurence of Samsungs5.
thanks in advance