mysql - How to remove any illegal new lines appears within a text files using vim text editor? -
i trying repair data file can use mysql data load infile import data database.
the problem having file there lengthy text contains new line in text. new line means new record. making hard me import records mysql.
how can use vim in linux search illegal new lines , replace them space?
illegal new line: if new line found between comma ( , ) , ( ,012d000 )
this sample data of file
vst-65654,a0jd000000fm8cbeat,blah,2013-10-22 10:46:30.000000,blah blah,2014-01-20 20:27:42.000000,2013-10-18 14:00:00.000000,005d0000002bir4aai,001d000001neh0oaad,in person,unscheduled,grow applications,high,this body of log test need remove new lines,012d0000000ppixaaq vst-122549,a0jd000000gvwtyead,blah,2013-10-31 18:17:50.000000,blah,2013-11-06 18:07:47.000000,2013-10-31 18:10:00.000000,005d0000002bir9aai,001d000001neaqgaal,in person,scheduled,grow applications,medium,one more long paragraph need remove new lines ,012d0000000ppiabcd the fields separated comma ( , ) , new record should begin when new line \n found. how can such search replace fix issue?
or how can replace unescaped commas double quotes? is, if find \, don't touch it, if find comma replace ","
thanks
g/^vst/,-/,012d000/j! use global command, :g join together, :j, line starting vst lines through next instance of 012d000.
for more see:
:h :g :h :j :h [range]
Comments
Post a Comment