combining multiple lines to single line

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, MudGuard

Post Reply
phani
Posts: 2
Joined: Sun Oct 19, 2008 6:40 am

combining multiple lines to single line

Post by phani »

I had below sample data

'1000329',xx,Coi,03-JAN-62 12.00. AM,ORANG
E,2800

i want the data to be in single line

'1000329',xx,Coi,03-JAN-62 12.00. AM,ORANGE,2800
ben_josephs
Posts: 2464
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

Under exactly what circumstances do you want lines joined?
phani
Posts: 2
Joined: Sun Oct 19, 2008 6:40 am

Post by phani »

The above sample data is the one of the record in the resultset obtained from database After formatting the data in textpad i need to save the file as .csv format .Some of the records obtained from resultset are aligned in same line but some records are like above.There are total of 20,000 records like this Editing them manually is taking one day completely
Pls help on this.
ben_josephs
Posts: 2464
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

That is not an answer to the question. Only you know what your records look like.

How do we distinguish between complete lines and split ones? Can we tell by the number of commas? Can quoted fields contain commas?

If the incomplete lines are those that contain fewer than 5 commas and if the fields do not contain commas, then this might do what you want. It finds each line containing fewer than 5 commas and removes the newline at the end:
Find what: ^(([^,]*,){0,4}[^,]*)\n
Replace with: \1

[X] Regular expression

Replace All
This assumes you are using Posix regular expression syntax:
Configure | Preferences | Editor

[X] Use POSIX regular expression syntax
Post Reply