Sponsored Content
Top Forums UNIX for Dummies Questions & Answers I have the logic down but syntax .... =( Post 302240857 by ghostdog74 on Friday 26th of September 2008 08:49:04 PM
Old 09-26-2008
if its too hard for you to grasp, here's an alternative if you have , in Python
Code:
d={}
for lines in open("file2"):
    l=lines.strip().split()
    #store last element as key , the whole line as value into lookup table d
    d[ l [-1] ] = lines.strip() 
for lines in open("file1"):
    l=lines.strip()
    print d[l]

 

We Also Found This Discussion For You

1. UNIX for Dummies Questions & Answers

Help | Unix | grep | regular expression | backreference | Syntax/Logic

Hello, I'm working on learning regular expressions and what I can do with them. I'm using unix to and its programs to experiment and learn what my limitations are with them. I'm working on duplicating the regular expression: ^(.*)(\r?\n\1)+$ This is supposed to delete duplicate lines... (2 Replies)
Discussion started by: MykC
2 Replies
All times are GMT -4. The time now is 02:21 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy