How Get all the line from a text file who has a specific word

I want to see all the text on the line where I find a specific word in a text document
for example:
The text file have:

i find the word “ADD FWIMSIBLK” and i want to save all the line

ADD FWIMSIBLK:NAME=“CAP_CdGT-120631_IMSI-310160”,MRI=4001,IMSI=“310160”,NTYPE=PASS;
ADD FWIMSIBLK:NAME=“CAP_CdGT-120631_IMSI-310200”,MRI=4001,IMSI=“310200”,NTYPE=PASS;
ADD FWIMSIBLK:NAME=“CAP_CdGT-120631_IMSI-310240”,MRI=4001,IMSI=“310240”,NTYPE=PASS;
ADD FWIMSIBLK:NAME=“CAP_CdGT-120631_IMSI-310250”,MRI=4001,IMSI=“310250”,NTYPE=PASS;
ADD FWIMSIBLK:NAME=“CAP_CdGT-120631_IMSI-310260”,MRI=4001,IMSI=“310260”,NTYPE=PASS;
ADD FWIMSIBLK:NAME=“CAP_CdGT-120631_IMSI-310270”,MRI=4001,IMSI=“310270”,NTYPE=PASS;

Hi,

How about the following?

String.Join(vbCrLf,strText.Split(vbCrLf.ToCharArray,StringSplitOptions.RemoveEmptyEntries).Where(Function(s) s.Contains(keyword)))

Sample
Sequence.xaml (6.9 KB)

Regards,

Thank you @Yoichi :smiling_face_with_three_hearts:

Thanks
Shaik

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.