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:

imagemagic add text to image

rem different types of text annotations on existing images rem cyan yellow orange gold rem -gravity SouthWest rem draw text and anno...