Carriage Returns

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
trespasser
Posts: 11
Joined: Wed Jul 02, 2003 6:48 am

Carriage Returns

Post by trespasser »

Hi all, bit new to this, having read through the forums I am none the wiser :-) I have a text file where the columns are broken up using the group by pp.vendorid, vg.vendorgroupid, vg.nameipe key (|) but there have been unwanted carriage returns inserted, like half way through a description, how can I get text pad to put one whole record on each line.
Any help would be gratefully accepted as it's driving me up the wall now :-))
Ed
Posts: 103
Joined: Tue Mar 04, 2003 9:09 am
Location: Devon, UK

Post by Ed »

1. Can you post a sample of the text before and after it has been fixed?
2. Is the order of the records important?
3. On a "good" record, are there exactly 2 | dividers?
4. On a "good"record, does the line end with a |?

A possible solution (depending on the above replies) is to identify all the "bad records and then delete the appropriate returns in those lines. But let's wait and see your answers first.
trespasser
Posts: 11
Joined: Wed Jul 02, 2003 6:48 am

Post by trespasser »

Hi there, thanks for the reply, below is a example of a bad record

19|'Northern'|'The Hollies'|'01347 833154'|'01347833154'|'Station Road,,
Tollerton,,
Yorkshire,,
YO61 1TS'|'All properties on this site are now sold subject to contract. Please contact the site for further details.',,




I would like the whole record on one line rather than over 5 lines, there are about 500 records in my text file, any help would be great.

Thansk Phil
Ed
Posts: 103
Joined: Tue Mar 04, 2003 9:09 am
Location: Devon, UK

Post by Ed »

In this particular case search for
\n\([^|]+\)$
and replace all with
\1
(reg exp of course) would be a start.
(this will append all lines with no "|" to the previous line)
then search for
\n\([^|]*|[^|]*\)$
replace with
\1
(this will append all lines with one "|" to the previous line)
then
\n\([^|]*|[^|]*|[^|]*\)$
then
\n\([^|]*|[^|]*|[^|]*|[^|]*\)$

etc

Hey, so it's not as elegant as you'd like but it sure beats doing it all by hand :)
trespasser
Posts: 11
Joined: Wed Jul 02, 2003 6:48 am

Post by trespasser »

Thanks for the reply, it works great, once I had it sorted once it was something I could autmate, your help was much appreciated.

Thanks Phil
trespasser
Posts: 11
Joined: Wed Jul 02, 2003 6:48 am

Post by trespasser »

Just one quick question, it completed half of the document but is now saying the first exspression cant be found \n\([^|]+\)$ there is nothing different to the rest of the file........

Thanks Phil
Ed
Posts: 103
Joined: Tue Mar 04, 2003 9:09 am
Location: Devon, UK

Post by Ed »

I guess it just means that there are no lines with no |s in them
Post Reply