I tried searching both google and the website for a similar problem but I couldn't really find what I was looking for. I have 2 files, both are filled only with numbers. I want to know how to compare FileB to the lines in FileA, and if a line in FileB isn't in FileA, simply ignore it. After comparing, I want to print only specific data from FileA. To further explain both are already sorted numerically:
103445 -630 103572 -638 107586 -133 109754 -466 111900 -643 112699 -371 112991 -17 113863 -175 114189 -691
101191 1136 103184 1322 103445 -210 103572 1424 104618 28 105395 1052
as you can see, lines 1-2 in B aren't in A, so I ignore them completely. I only want to save the lines with first 6 characters in B that are in A. Then I have some other commands to run but I think I know how to do those, just need to squeeze out the relevant data.
I tried using Comm but it didn't really provide the solution I was looking for...
Edit: I also have to keep the other column data, because my next step is to check if the value in col2 is equal or greater than half of the value in the corresponding like on FileB (abs val). I want to keep only those in the end. For example, after all the commands are executed I need it to print only col1 data from FileA that matches these criteria. In the current example above nothing will print out, but in my larger file with 1000's of line stuff will be printed.