epimenidecretese has asked for the wisdom of the Perl Monks concerning the following question:
Ciao guys,
I'm trying to solve a problem with some text I have. I have processed two text files and now I have something like this:
| wordF1 | percentageF1 | wordF2 | percentageF2 | |------------+--------------+--------------+--------------| | politici | 0.0489 | politici | 0.0295 | | referendum | 0.0238 | consenso | 0.0126 | | verità | 0.0198 | referendum | 0.00654 | | scandalo | 0.0112 | verità | 0.00526 | | vergogna | 0.00723 | tradizionali | 0.00343 | | corrotto | 0.00439 | tradizione | 0.00266 | | scandali | 0.00394 | tradizioni | 0.00234 | | consenso | 0.00373 | tradizionale | 0.0022 | | corrotti | 0.00332 | scandalo | 0.00142 | | propaganda | 0.0027 | vergogna | 0.00131 | |------------+--------------+--------------+--------------|
What I am trying to do is to align the words (so I understand I should do some string compairison but then I don't know how) by keeping file1 as reference: this means that if a word is present in file1 but not in file2 then the whole raw should be deleted. Once this is done I would like to compute the differences of the percentages (f1-f2).
At the end I would like something like this:
| wordF1 | wordF2 | difference | |------------+------------+------------| | politici | politici | +0.5 | | referendum | referendum | +0.126 | | verità | verità | +0.006 | | ... | ... | ... | |------------+------------+------------|
I was trying to do this in awk but after a lot of tryings I gave up. If somebody could help I'd be very happy.
One of Crete's own prophets has said it: 'Cretans are always liars, evil brutes, lazy gluttons'.
He has surely told the truth.
|
---|
Back to
Seekers of Perl Wisdom