I have a "|" delimited file that is exported from a database.
There is one column in the file which has description/comments entered by some application user. It has "Control-M" character and "New Line" character in between the text.
Hence, when i export the data, this record with the new line character splits the record into 2.
Hence, the load fails. Following is an example :
1|user|i am happy.
2|user|i live
in india.
3|user|i am male.
I tried to replace the characters but was unable to do it between the 3rd column. And replace caused legal ones to be replaced as well.
Basically, i want to search a particular special character within the string of nth column.
In your example, it appears that you have an extra <CR> and <LF> in the 3rd field that are before the end of field/line. Is that what you are trying to eliminate?
I added a delimiter | and ~ characters to end of each line; this may be needed so as only to change CR and LF within the 3rd field.
the \151 is the octal representation for i in hairy. Thus, find the codes for CR and LF and try the above for your example.
Relying on what you describe, i.e. that the <CR> char is the indicator of the inappropriate line split (implying there will be no <CR> in the last line), this might do: