As a part of my requirement I am using http origin to connect to end point and need to perform lookup on file to get relevant data from file.How to perform lookup on a file using streamsets
Already have an account? Login
Login to the community
No account yet? Create an account
Enter your username or e-mail address. We'll send you an e-mail with instructions to reset your password.
In this case you can use script processors(jython,groovy etc) to do lookup on the files.
You can write code like below.
def search_str(file_path, word):
with open(file_path, 'r') as file: # read all content of a file content = file.read() # check if string present in a file
if word in content: print('string exist in a file') else: print('string does not exist in a file') search_str(r'E:\demos\files_demos\account\sales.txt', recode.value(‘patternstring’))
Thanks & Regards