in reply to Aligning text and then perfom calculations
Use the split technique kcott showed you in Re: Condition on multiple lines and big file to split your line up into an array. Try writing the code for yourself and if you run into trouble come back for more help.
So far you've asked for and been given a lot of fish. Now it's time you learned to fish for yourself.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Aligning text and then perfom calculations
by epimenidecretese (Acolyte) on Dec 15, 2013 at 22:12 UTC | |
I went out fishing and brought home something. I got the data in a way to fit the previous script and now I can print the rows that match, but still can't skip the one who don't. Thank you very much for pointing me in the correct direction. I'd be happy to figure it out myself if you could give me one more tip on this way. What I can't figure out is how to sort before comparing and printing, so that I get the words that are present in both lists but are not aligned.
OUTPUT:
One of Crete's own prophets has said it: 'Cretans are always liars, evil brutes, lazy gluttons'. | [reply] [d/l] [select] |
by GrandFather (Saint) on Dec 15, 2013 at 23:24 UTC | |
This is more efficient if you have the data available as two files. Build a lookup table (hash) using the first file then consult it while reading the second file:
Prints:
If you only have the combined rows available then you need two lookup tables. Populate the tables in the file input loop, then loop over the keys from one of the tables to generate the output:
prints:
True laziness is hard work
| [reply] [d/l] [select] |
by epimenidecretese (Acolyte) on Dec 16, 2013 at 09:18 UTC | |
That is exactly what I was looking for now. Thanks a lot. Problem solved.
One of Crete's own prophets has said it: 'Cretans are always liars, evil brutes, lazy gluttons'. | [reply] [d/l] |