Question

Lookup on file

  • 23 March 2023
  • 1 reply
  • 31 views

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


1 reply

Userlevel 5
Badge +1

@Rohith 

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

Bikram_

Reply