Let's say I have a baseline file like this:
And a newly created file looks like this:
In theory, these two files are the SAME, because:
1) the first line (in red) can be ignored
2) the blue lines are the same even if at different location.
So, in this case, we cannot simply use File::Compare.
What I did was read both files into hashes and each line is a hash key. The first line is not in the hashes. Then I can compare hash keys through a loop. The implementation is omitted cause it's too simple.
I sense there must be a smarter way to implement this. But I don't know how. So I am here to ask experts for help.
Thanks!
Code:
4.1.27-4.1.2-amd64-[COLOR=red]1cccde6e81b2c42b[/color]
cmos2q installed and running
lm-sensors2q installed and running
lspci2q installed and running
mcelog2q installed and running
[COLOR=blue]mpt2q not needed[/color]
pmbus2q installed and running
smartmon2q installed and running
And a newly created file looks like this:
Code:
4.1.27-4.1.2-amd64-[COLOR=red]b2c2cfc7c5cc6d49[/color]
cmos2q installed and running
lm-sensors2q installed and running
lspci2q installed and running
mcelog2q installed and running
pmbus2q installed and running
smartmon2q installed and running
[COLOR=blue]mpt2q not needed[/color]
In theory, these two files are the SAME, because:
1) the first line (in red) can be ignored
2) the blue lines are the same even if at different location.
So, in this case, we cannot simply use File::Compare.
What I did was read both files into hashes and each line is a hash key. The first line is not in the hashes. Then I can compare hash keys through a loop. The implementation is omitted cause it's too simple.
I sense there must be a smarter way to implement this. But I don't know how. So I am here to ask experts for help.
Thanks!