Skip to main content
Question

Lookup on file

  • March 23, 2023
  • 1 reply
  • 52 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

Bikram
Headliner
Forum|alt.badge.img+1
  • Headliner
  • 486 replies
  • March 23, 2023

@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_