Jump to content

Compare lists [solved]


Recommended Posts

Hello.

I've stumbled across this problem, seeing if I can sort it out.

I have two text files, that contain one term per line. The second file contains some terms that are common to the first one.

I need to find a way to (using shell scripting, perl, or python):

 

a. identify the common items;

b. identify where the common items are in the first file (with line number).

 

Point b is what I can't seem to do. I can easily get the common items with the bash join command but I haven't found a way to "trace" them back to their positions in the first file.

I can't seem to get this issue sorted out. If you have any advice, I'd be very helpful.

Edited by lbbros
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...