Page 1 of 1
Carriage Returns
Posted: Wed Jul 02, 2003 7:00 am
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

)
Posted: Wed Jul 02, 2003 10:14 am
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.
Posted: Wed Jul 02, 2003 10:32 am
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
Posted: Wed Jul 02, 2003 10:29 pm
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

Posted: Thu Jul 03, 2003 6:12 am
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
Posted: Thu Jul 03, 2003 6:18 am
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
Posted: Thu Jul 03, 2003 1:20 pm
by Ed
I guess it just means that there are no lines with no |s in them