I am a new dev here, but trying to learn as much as I can. I am trying to figure out how to search through a text file and cut out rows if it finds a specific value. Ex: I need to search through the rows of a .txt file and if there is a ‘123456789’ found, cut that row and paste into a separate notepad file. Any suggestions?
Of course, it’s so simple. Just read the text file line by line and store in an array of type string. Then loop through the array and check if that line has the required value and append it to the another string variable with new line in the end so that every row will be added to the new row.
Hope this helps @scott.coil
Here is the package to you that you can search and delete the lines.
Hope these steps would help you resolve this
—use READ TEXT FILE activity and pass the file path of the txt file as input and get the output with a variable of type string named str_input
—now use a assign activity like this
arr_lines = str_input.Split(Environment.NewLine.ToArray())
Where arr_files is a variable of type array of string
—now use a FOR EACH activity and pass the above variable arr_lines as input and change the type argument as string in the property panel
—inside the loop use a IF condition like this
If the condition passes it will go to THEN part where we can use WRITE TEXT FILE activity where mention the file path as
Where counter is a variable of type int32 with default value as 1
And pass the input string as item.ToString
—next to this step use a assign activity like this
counter = counter + 1
What @Palaniyappan said haha
Thx everyone! Time for me to take this info and run!