Hi @Amit kumar Yadava ,
You can refer to the following code.
Dim AllLines As List(Of String) = File.ReadAllLines(TxtTb2FilePath.Text).ToList()
Console.WriteLine(AllLines.Count)
Dim Stvill As String = ""
For index As Integer = AllLines.Count - 1 To 0 Step -1
If AllLines(index).Contains("Standing") Or AllLines(index).Contains("Society:") Or AllLines(index).Contains("Centre:") Or AllLines(index).Contains("=") Or AllLines(index).Contains("-") Or AllLines(index).Contains("") Or AllLines(index).Contains("Village Total") Or AllLines(index).Contains("Grand Total") Then
AllLines.RemoveAt(index)
End If
Next
Dim village As String = ""
For index As Integer = 0 To AllLines.Count - 1 Step 1
If AllLines(index).Contains("Village") Then
village = AllLines(index).Split(" ")(2)
ElseIf AllLines(index).Length > 9 Then
AllLines(index) = AllLines(index).Insert(9, vbTab & village)
End If
Next
File.WriteAllLines(IO.Path.Combine(Application.StartupPath, "Converted.txt"), AllLines)
Process.Start(IO.Path.Combine(Application.StartupPath, "Converted.txt"))
Best Regards.
Jiachen Li
If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.