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:

test smtp server with powershell

Send-MailMessage -SMTPServer smtp.domain.com -To [email protected] -From [email protected] -Subject "This is a test email" -Body ...