csv - How to match every beginning of new line of text in Regex? -
i'm in process of creating csv file out of text file. new regex , need finish csv file.
what need remove every new line of text , put them in 1 single line.
for example, data:
abc company inc 123 street winchester, ky
needed in format:
abc company inc;123 street;winchester, ky
plus, on file... has several entries 1 line-break every after 1 company.
it's this:
abc company 123 street winchester, ky def company 456 street winchester, ky
and make so:
abc company;123 street;winchester, ky def company;456 street;winchester, ky
can in regex? if so, how?
more info:
this not programming or coding related issue.
it's more of data conversion or manipulation. i'm using text editor. need edit text file (mined data) , convert csv file.
if there other tools might use this, please mention it.
update:
with particular problem @ hand, current level of knowledge, found answer of bohemian more helpful in case. did me task.
however, answer provided sobrique more powerful use. don't know how use well. did pearl script is... copied whole printed output of script since don't know how output file. plus, encountered inaccurate data. it's great tool, couldn't handle right now.
do replace this:
search: (?<=.)$(\s(?!^$))+^ replace: ;
then, remove blank lines:
search: ^$\s+ replace: <nothing>
those arounds there make sure blank lines (of 0 length) not matched.
Comments
Post a Comment