Thanks for the reply. This script works fine.
Is there any way to merge two lines based on specific occurance of a character
I am having a flat file which contains multiple records.
Each row in the file should contain specified number of delimiter.
For a particular row , if the delimiter count is not matched with the specified count, then then next row should be merged with the previous row. Again the same check has to be done.
The script should accept number of occurances of a particular delimiter as the parameter.
For Example if the number of occurances of comma in every line is 5 in a flat file
Sample Input
1,2,3,
4,5,6
a,b,c,d,e,f
10,20,30
,40,50,60
11,22
,33
,44,
55,
66
Output (Each row should contain 5 commas)
1,2,3,4,5,6
a,b,c,d,e,f
10,20,30,40,50,60
11,22,33,44,55,66
Mohan