You can make this easier by just reading the entire file into a string using File.ReadAllText [
^].
Then, you can perform some simple search-and-replace operations to transform the data you just read:
private string SampleData = @"-first line
-second line
-third line
continues
-fourh l";
private string replaceString = "-";
private string MassageData(string theData)
{
theData = theData.Replace(Environment.NewLine, " ");
theData = theData.Replace(replaceString, Environment.NewLine + replaceString);
theData = theData.Replace(" ", " ");
theData = theData.Trim();
}
private void TestTransformData()
{
string transformedData = MassageData(SampleData);
Console.WriteLine(transformedData);
}