Re: Getting Rid of Multiple Returns

This WebDNA talk-list message is from

2001


It keeps the original formatting.
numero = 40068
interpreted = N
texte = Velma Kahn, 10/17/01 > > Has anyone been successful in getting out multiple returns from a text file > > or an HTML file, using GREP or CONVERTCHARS (or any other method)? I want > > to find all cases where there are 2 or more returns, and replace them with > > one return. Nothing I've tried has worked so far. Unfortunately, my > > development machine is Win2000 and my live machine is a Mac, so even if I > > get it working in development maybe it won't work on the Mac.Joseph Sullivan, 10/17/01 >[convertchars db=customchar.db]Your text goes here[/convertchars] >Make a simple db that will look something like this and name it >customchar.db, or whatever you want...... > >from--tab--to >%0D--tab--
>%0B--tab--
>This is a tab delimited db... >Hope this helps...Rob Marquardt, 10/18/01 >This does the trick (but then, I dev and serve on a Mac ; ) > >[grep search=%0D%0D*&replace=%0D][sourceText][/grep]This is what ended up working for me. I document it now for the use of some future developer who has the same problem, and can find this searching the archives. My tpl files were developed on Win2000. They are then used to generate html files, processed to remove excess white space--both on the Win2000 machine and on the real Mac server, using the following procedure. Rob's grep doesn't work for me even on the Mac-most likely because the tpl files were created on a Win2000 machine I would guess. To my surprise, this code set works for me on both platforms. Of course, this all might be affected by FTP settings too. I couldn't get grep to do it all, and I couldn't get convertchars to do it all, or convertwords to do anything.[SEARCH db=[_TableDir]/Products.db&neStaticURLdata=[blank]&asSKUsort=1] Num Found: [NumFound]
[TEXT show=F]_Count=0[/TEXT] [FOUNDITEMS] [TEXT show=F]_OutFile=products/[StaticURL][/TEXT] [TEXT show=F]_InFile=[_ProductsDir]/[OnClickFromList].tpl[/TEXT] Static URL: [_OutFile]; Dynamic URL: [_InFile]
[TEXT show=F]_X=[INCLUDE file=[_InFile]][/TEXT] [TEXT show=F]_X=[CONVERTCHARS db=customchars.db][_X][/CONVERTCHARS][/TEXT] [LOOP start=1&end=4] [TEXT show=F]_X=[GREP search=CRLFCRLF&replace=CRLF][_X][/GREP][/TEXT] [/LOOP] [TEXT show=F]_X=[GREP search=CRLF&replace=%0D%0A][_X][/GREP][/TEXT] [WRITEFILE file=[_OutFile]&secure=f][_X][/WRITEFILE] [TEXT show=F]_Count=[MATH][_Count]+1[/MATH][/TEXT] [/FOUNDITEMS] [/SEARCH] Product Files Written: [TEXT show=t][_Count][/TEXT]
customchars.db contains: from to %09 %0D CR %0A LFI know it seems that there would be a simpler way, but I tried many many things, and this one works in my particular circumstance. I can get grep to replace the tabs with blank (%09), but I can't get it to deal with the CR (%0D) LF (%0A) combinations, no matter what I try. So I have this odd customchars step, and that does it.Velma Kahn velma@swva.net ------------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://search.smithmicro.com/ Associated Messages, from the most recent to the oldest:

    
  1. Re: Getting Rid of Multiple Returns (Velma Kahn 2001)
  2. Re: Getting Rid of Multiple Returns (Rob Marquardt 2001)
  3. Re: Getting Rid of Multiple Returns (Joseph Sullivan 2001)
  4. Getting Rid of Multiple Returns (Velma Kahn 2001)
Velma Kahn, 10/17/01 > > Has anyone been successful in getting out multiple returns from a text file > > or an HTML file, using GREP or CONVERTCHARS (or any other method)? I want > > to find all cases where there are 2 or more returns, and replace them with > > one return. Nothing I've tried has worked so far. Unfortunately, my > > development machine is Win2000 and my live machine is a Mac, so even if I > > get it working in development maybe it won't work on the Mac.Joseph Sullivan, 10/17/01 >[convertchars db=customchar.db]Your text goes here[/convertchars] >Make a simple db that will look something like this and name it >customchar.db, or whatever you want...... > >from--tab--to >%0D--tab--
>%0B--tab--
>This is a tab delimited db... >Hope this helps...Rob Marquardt, 10/18/01 >This does the trick (but then, I dev and serve on a Mac ; ) > >[grep search=%0D%0D*&replace=%0D][sourceText][/grep]This is what ended up working for me. I document it now for the use of some future developer who has the same problem, and can find this searching the archives. My tpl files were developed on Win2000. They are then used to generate html files, processed to remove excess white space--both on the Win2000 machine and on the real Mac server, using the following procedure. Rob's grep doesn't work for me even on the Mac-most likely because the tpl files were created on a Win2000 machine I would guess. To my surprise, this code set works for me on both platforms. Of course, this all might be affected by FTP settings too. I couldn't get grep to do it all, and I couldn't get convertchars to do it all, or convertwords to do anything.[SEARCH db=[_TableDir]/Products.db&neStaticURLdata=[blank]&asSKUsort=1] Num Found: [NumFound]
[TEXT show=F]_Count=0[/TEXT] [founditems] [TEXT show=F]_OutFile=products/[StaticURL][/TEXT] [TEXT show=F]_InFile=[_ProductsDir]/[OnClickFromList].tpl[/TEXT] Static URL: [_OutFile]; Dynamic URL: [_InFile]
[TEXT show=F]_X=[INCLUDE file=[_InFile]][/TEXT] [TEXT show=F]_X=[CONVERTCHARS db=customchars.db][_X][/CONVERTCHARS][/TEXT] [LOOP start=1&end=4] [TEXT show=F]_X=[GREP search=CRLFCRLF&replace=CRLF][_X][/GREP][/TEXT] [/LOOP] [TEXT show=F]_X=[GREP search=CRLF&replace=%0D%0A][_X][/GREP][/TEXT] [WRITEFILE file=[_OutFile]&secure=f][_X][/WRITEFILE] [TEXT show=F]_Count=[math][_Count]+1[/MATH][/TEXT] [/FOUNDITEMS] [/SEARCH] Product Files Written: [TEXT show=t][_Count][/TEXT]
customchars.db contains: from to %09 %0D CR %0A LFI know it seems that there would be a simpler way, but I tried many many things, and this one works in my particular circumstance. I can get grep to replace the tabs with blank (%09), but I can't get it to deal with the CR (%0D) LF (%0A) combinations, no matter what I try. So I have this odd customchars step, and that does it.Velma Kahn velma@swva.net ------------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://search.smithmicro.com/ Velma Kahn

DOWNLOAD WEBDNA NOW!

Top Articles:

Talk List

The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...

Related Readings:

[time] math Q (2003) Register First (2000) Entry point? Security w/ dbase helper? (1997) [ModDate] & [ModTime] ? (1997) WebCat2 beta 11 - new prefs ... (1997) military time (2002) [OT] Yahoo! Front Page (2002) Last desperate attempt (1998) Verifying both name and password (was: New Problem) (1997) Pre-parse hell (2008) upgrade? (1997) [ModDate] & [ModTime] ? (1997) Img in goodpath (2001) 2nd WebCatalog2 Feature Request (1996) Searching multiple fields (1997) PARAMETER vs. OPERATOR (was The BUG is BACK ...) (1998) WebCat2 several catalogs? (1997) customizing the color of user's pages (1997) Only charge card when product shipped ? (1997) rename a file (1997)