Wednesday

find lines from one file into another

How to find lines from one file into another ?
here is sample script showing lines from "find.txt" file those are into "findinto.txt"

common.py find.txt findinto.txt


import os
import re
import sys

fileHandle = open (sys.argv[1])
linesToPatch = fileHandle.readlines()
f = open(sys.argv[2])

for aline in f:
for rline in linesToPatch:
p=re.compile(rline.strip())
if p.search(aline.strip()):
print aline

No comments:

make ubuntu business casual

to make ubuntu business casual - make it black remove background: gsettings set org.gnome.desktop.background picture-options ...