Hi all,
I am facing a problem with frequent data shift when a .csv file imported with delimited input. The data is somewhere broken and shifted to the next line, therefore throws an error in the workflow. This issue is caused when the data is extracted from source systems, and we do not have any control over this process.
I have given the sample data with the line numbers at which the shift occurs below :
Data I have
In this data, a sentence is broken into different adjacent lines and I need these to concatenate into a single line based on the line number.
The output that i need to get is as shown below:
Data I need
The idea is to find out the adjacent line numbers at which the line shift occurs and concatenate into the previous line so that the initial line at which shift starts gives the proper sentence.
Note: It will be preferred to get a solution which automatically groups out the adjacent line numbers at which the shift occurs and then concatenate the largest line number with the previous one so on. I am trying to automate this process since it is a common issue I face in my work.
Thanks in advance