faheem14
(FAHEEM HUSSAINI)
November 24, 2022, 10:02am
1
Delete lines from Notepad where Line contains specific data
Use Case Description
I want to Delete the Text File line where the line contains a specific value.
AS-IS WORKFLOW, TO-BE WORKFLOW
Other information about the use case
Industry categories for this use case : Information Technology and Services
Skill level required : Intermediate
UiPath Products that were used : UiPath Studio
Other applications that were used : Notepad
Other resources : -
What is the top ROI driver for this use case? : Improve customer experience
Anil_G
(Anil Gorthi)
November 24, 2022, 10:10am
2
Hi @faheem14
Read the data using read text file
then split the output on Environment.Newline
Then loop through each item and check for required keyword using if condition item.contains(“requireddata”). on false side , Add the line to a separate array
then join the array back using string.join function and write data back to excel
Else use the expression directly
String.Join(Environment.NewLine,str.Split(Environment.NewLine,StringSplitOptions.None).Where(function(x) Not x.Contains(“RequiredString”)).ToArray)
str is the output from read text file
Requiredstring is what you are searching for
Use assign and assign this back to str
write str back to text file
cheers
1 Like
faheem14
(FAHEEM HUSSAINI)
November 29, 2022, 3:26pm
3
@Anil_G Thank you so much it worked.
1 Like
Anil_G
(Anil Gorthi)
November 29, 2022, 3:30pm
4
HI @faheem14
Happy Automation
Can you please close the topic by marking solutions so that others with similar query can get help
Forum FAQ - How to mark a post as a solution
This document is part of our beginners guide .
This article will teach you how to properly mark a post as a solution.
We were closely following our last UiPath Forum feedback round! topic and carefully extracted all the bits of feedback that was provided. As such, we would like to tackle the topic of solutions on our Forum and how to properly use them.
When is the topic resolved?
The topic can be considered resolved when the topic author has fo…
cheers