i need to split lines in text file based on a specific pattern.The pattern is " 01/12/12 00:39 AT400003".
The source file looks like:
AT400003 2012-12-01 00:36:03.000 abcdefghij 01/12/12 00:39 AT400003 abcdefjhij 01/12/12 01:39 AT400003 abcdefghij 01/12/12 00:39 AT400003 abcdefjhij
I need the output file to look like:
AT400003 2012-12-01 00:36:03.000 abcdefghij
01/12/12 00:39 AT400003 abcdefjhij
01/12/12 01:39 AT400003 abcdefghij
01/12/12 00:39 AT400003 abcdefjhij
But I get:
AT400003 2012-12-01 00:36:03.000 abcdefghij
abcdefjhij
abcdefghij
abcdefjhij
Below is the code:
string[] lines = System.Text.Reg ularExpressions .Regex.Split(ke ep, @"\s\s\s\d\d \/\d\d\/\d\d\s\d\d\:\d\ d\s\s\w\w\d\d\d \d\d\d");
foreach (string line in lines)
{ sw.WriteLine(li ne); }
Please advise how i can have the split expressions also included
The source file looks like:
AT400003 2012-12-01 00:36:03.000 abcdefghij 01/12/12 00:39 AT400003 abcdefjhij 01/12/12 01:39 AT400003 abcdefghij 01/12/12 00:39 AT400003 abcdefjhij
I need the output file to look like:
AT400003 2012-12-01 00:36:03.000 abcdefghij
01/12/12 00:39 AT400003 abcdefjhij
01/12/12 01:39 AT400003 abcdefghij
01/12/12 00:39 AT400003 abcdefjhij
But I get:
AT400003 2012-12-01 00:36:03.000 abcdefghij
abcdefjhij
abcdefghij
abcdefjhij
Below is the code:
string[] lines = System.Text.Reg ularExpressions .Regex.Split(ke ep, @"\s\s\s\d\d \/\d\d\/\d\d\s\d\d\:\d\ d\s\s\w\w\d\d\d \d\d\d");
foreach (string line in lines)
{ sw.WriteLine(li ne); }
Please advise how i can have the split expressions also included
Comment