cancel
Showing results for 
Search instead for 
Did you mean: 

Search for particular content in Text File

SOLVED
Raj48
Occasional Visitor

Search for particular content in Text File

Hi,

 

This is regarding content search in Text File. 

 

I have a Daily Settlement Text file which has previous day transactions (approx 100 lines with transaction date and type). Is there any better way to search for a particular transaction (from the entire file) and validate the variable details (for ex: Amount in the below format). I tried with aqTextFile.ReadLine/ ReadToSymbol. For some reason, its not helping.

 

Should i go for any regular expression here for searching the unique combination? (transaction date + Transaction Type) 

 

Ex File format:

 

Transaction Type: TXN1

Date and Time: 12-May-2021

Transaction details: Type 1 Transaction

Amount: $4

Agent name: Test Agent

Transaction Type: TXN2

Date and Time: 12-May-2021

Transaction details: Type 2 Transaction

Amount:$8

Agent name: Dummy Agent

Transaction Type: TXN3

Date and Time: 12-May-2021

Transaction details: Type 3 Transaction

Agent name: Sample Agent

Amount:$48

 

1 ACCEPTED SOLUTION

Accepted Solutions
Marsha_R
Community Hero

Re: Search for particular content in Text File

You could probably use a regular expression.  What I did in a similar case was to shove the text into a string variable and then search the string for the substring that I wanted.

 

So in your example I might first look for the substring Transaction Type: TXN2 Date and Time: 12-May-2021 and then search for the amount that immediately follows it by looking for the $.  Then you can verify the amount.

View solution in original post

1 REPLY 1
Marsha_R
Community Hero

Re: Search for particular content in Text File

You could probably use a regular expression.  What I did in a similar case was to shove the text into a string variable and then search the string for the substring that I wanted.

 

So in your example I might first look for the substring Transaction Type: TXN2 Date and Time: 12-May-2021 and then search for the amount that immediately follows it by looking for the $.  Then you can verify the amount.

View solution in original post

New Here?
Join us and watch the welcome video:
Announcements